MrKim Well-Known Member Licensed User Longtime User Sep 28, 2017 #1 In VBA you can generate a string of ASCII Characters with: String(Num, "Char") Does B4A have an equivalent?
In VBA you can generate a string of ASCII Characters with: String(Num, "Char") Does B4A have an equivalent?
Erel B4X founder Staff member Licensed User Longtime User Sep 28, 2017 #2 What is Num? What is the expected output? Upvote 0
MrKim Well-Known Member Licensed User Longtime User Sep 28, 2017 #3 Erel said: What is Num? What is the expected output? Click to expand... Sorry we use that a lot when the value is a number. Code: Copy String(10, "D") would give give you "DDDDDDDDDD" Upvote 0
Erel said: What is Num? What is the expected output? Click to expand... Sorry we use that a lot when the value is a number. Code: Copy String(10, "D") would give give you "DDDDDDDDDD"
Misterbates Active Member Licensed User Sep 28, 2017 #4 Here you go. Code: Copy Sub MakeString(Num As Int, Chars As String) As String Dim s As StringBuilder s.Initialize For i = 1 To Num s.Append(Chars) Next Return s.ToString End Sub Upvote 0
Here you go. Code: Copy Sub MakeString(Num As Int, Chars As String) As String Dim s As StringBuilder s.Initialize For i = 1 To Num s.Append(Chars) Next Return s.ToString End Sub
Misterbates Active Member Licensed User Sep 28, 2017 #5 Also, take a look at the repeat function in this library https://www.b4x.com/android/forum/threads/90-string-manipulation-methods.73564/#post-467232 Upvote 0
Also, take a look at the repeat function in this library https://www.b4x.com/android/forum/threads/90-string-manipulation-methods.73564/#post-467232
Misterbates Active Member Licensed User Sep 28, 2017 #6 Apologies, didn't notice that the link in post #5 goes to a B4J library. Here's one for B4A (look for the Copies function) https://www.b4x.com/android/forum/threads/new-version-of-mlstr-string-library.36530/#post-214687 Upvote 0
Apologies, didn't notice that the link in post #5 goes to a B4J library. Here's one for B4A (look for the Copies function) https://www.b4x.com/android/forum/threads/new-version-of-mlstr-string-library.36530/#post-214687
Star-Dust Expert Licensed User Longtime User Sep 28, 2017 #7 Code: Copy Sub DoString(Num as int,Character as String) as string ' 100 space Dim S As String = " " 'S= S & S & S & S & S & S & S & S ' Make S * 8 return s.substring2(0,Num).Replace(" ",Character) End Sub Upvote 0
Code: Copy Sub DoString(Num as int,Character as String) as string ' 100 space Dim S As String = " " 'S= S & S & S & S & S & S & S & S ' Make S * 8 return s.substring2(0,Num).Replace(" ",Character) End Sub
MrKim Well-Known Member Licensed User Longtime User Oct 5, 2017 #8 Thanks all. More than I needed, just wondering if there was a built in function. Upvote 0