S straybullet Member Licensed User Longtime User May 8, 2012 #1 Ok I maybe missed it in the docs... But I want to see if a string begins with the number 1 and if so remove it from the beginning only. I don't care if the number 1 appears anywhere else in the string, it as long as its not at the beginning. Some languages have strleft and strreplace, but do not see them in B4a, any suggestions will be greatly appreciated. Thanks
Ok I maybe missed it in the docs... But I want to see if a string begins with the number 1 and if so remove it from the beginning only. I don't care if the number 1 appears anywhere else in the string, it as long as its not at the beginning. Some languages have strleft and strreplace, but do not see them in B4a, any suggestions will be greatly appreciated. Thanks
NJDude Expert Licensed User Longtime User May 8, 2012 #2 You have to use "StartsWith", for example: Code: Copy Dim str As String If str.StartsWith("1") Then ... Upvote 0
You have to use "StartsWith", for example: Code: Copy Dim str As String If str.StartsWith("1") Then ...
S straybullet Member Licensed User Longtime User May 8, 2012 #3 Not asking to you to code it for me, but if there a trimleft command I am missing? Thanks Upvote 0
NJDude Expert Licensed User Longtime User May 8, 2012 #4 There's no "TrimLeft" but you can do something like this: Code: Copy Dim str As String str = "1 Hello there" If str.StartsWith("1") Then str = str.SubString(1) End If Msgbox(str, "") Upvote 0
There's no "TrimLeft" but you can do something like this: Code: Copy Dim str As String str = "1 Hello there" If str.StartsWith("1") Then str = str.SubString(1) End If Msgbox(str, "")
margret Well-Known Member Licensed User Longtime User May 8, 2012 #5 You can try these: http://www.b4x.com/forum/basic4android-getting-started-tutorials/10365-string-functions.html Upvote 0
You can try these: http://www.b4x.com/forum/basic4android-getting-started-tutorials/10365-string-functions.html
S straybullet Member Licensed User Longtime User May 8, 2012 #6 Thanks you two, Margret I noticed the following.. s.At() s.Left() s.Len() s.Ltrim() s.Mid() s.Right() s.Rtrim() s.Stuff() s.Trim() s.Val() Am I missing a library or these built in commands I have not found docs on? margret said: You can try these: http://www.b4x.com/forum/basic4android-getting-started-tutorials/10365-string-functions.html Click to expand... Upvote 0
Thanks you two, Margret I noticed the following.. s.At() s.Left() s.Len() s.Ltrim() s.Mid() s.Right() s.Rtrim() s.Stuff() s.Trim() s.Val() Am I missing a library or these built in commands I have not found docs on? margret said: You can try these: http://www.b4x.com/forum/basic4android-getting-started-tutorials/10365-string-functions.html Click to expand...
NJDude Expert Licensed User Longtime User May 8, 2012 #7 Those functions are a code module written by Margret and some other members, they are no part of B4A. Last edited: May 8, 2012 Upvote 0
Those functions are a code module written by Margret and some other members, they are no part of B4A.
margret Well-Known Member Licensed User Longtime User May 8, 2012 #8 Hello, it is a code module. No libraries are needed. You can download it from the link I gave. You can unzip it and then copy and paste the code in a module named s. Thanks NJDude. I was typing and got a phone call. When I posted I saw you had already posted the answer. Thanks Last edited: May 8, 2012 Upvote 0
Hello, it is a code module. No libraries are needed. You can download it from the link I gave. You can unzip it and then copy and paste the code in a module named s. Thanks NJDude. I was typing and got a phone call. When I posted I saw you had already posted the answer. Thanks
netchicken Active Member Licensed User Longtime User May 8, 2012 #9 What about... if string.indexOf("1") = 1 then .... Upvote 0
T Thomas Wong Member Licensed User Longtime User Jun 9, 2013 #10 Encrypt and Decrypt Hi, Any idea how to use the Encrypt and Decrypt function in StringFunctions library? How can I specify the salt/key for it? Regards, Thomas Upvote 0
Encrypt and Decrypt Hi, Any idea how to use the Encrypt and Decrypt function in StringFunctions library? How can I specify the salt/key for it? Regards, Thomas