T TestMyChess Member Licensed User Longtime User Feb 21, 2014 #1 Hi, Is there any inbuilt function to repeat a string? For example Repeat("spam ", 3) would return "spam spam spam ". Obviously I could knock up my own but I have a feeling I'd be reinventing a wheel. Thanks. John
Hi, Is there any inbuilt function to repeat a string? For example Repeat("spam ", 3) would return "spam spam spam ". Obviously I could knock up my own but I have a feeling I'd be reinventing a wheel. Thanks. John
RandomCoder Well-Known Member Licensed User Longtime User Feb 21, 2014 #2 Hi John, Although not an authority on B4A, I've played with it for a while now and I'm not aware of any such function. Regards, RandomCoder Upvote 0
Hi John, Although not an authority on B4A, I've played with it for a while now and I'm not aware of any such function. Regards, RandomCoder
margret Well-Known Member Licensed User Longtime User Feb 21, 2014 #3 B4X: Sub Repeat(mText As String, Num As Int) As String Dim Rstr = "" As String For i = 0 To Num -1 Rstr = Rstr & mText Next Return Rstr End Sub Upvote 0
B4X: Sub Repeat(mText As String, Num As Int) As String Dim Rstr = "" As String For i = 0 To Num -1 Rstr = Rstr & mText Next Return Rstr End Sub
M Mahares Expert Licensed User Longtime User Feb 21, 2014 #4 In addition to Margerite's post, here is a link to HotShoe's string library that does exactly what you want: http://www.b4x.com/android/forum/threads/new-version-of-mlstr-string-library.36530/#post-214687 Upvote 0
In addition to Margerite's post, here is a link to HotShoe's string library that does exactly what you want: http://www.b4x.com/android/forum/threads/new-version-of-mlstr-string-library.36530/#post-214687
T TestMyChess Member Licensed User Longtime User Feb 22, 2014 #5 Mahares said: In addition to Margerite's post, here is a link to HotShoe's string library that does exactly what you want: http://www.b4x.com/android/forum/threads/new-version-of-mlstr-string-library.36530/#post-214687 Click to expand... Thanks. Looks like I have a choice of two libraries of string functions, MLStr and Margret's String Functions, plus the built in stuff. That should stop me having to reinvent too many wheels. John Upvote 0
Mahares said: In addition to Margerite's post, here is a link to HotShoe's string library that does exactly what you want: http://www.b4x.com/android/forum/threads/new-version-of-mlstr-string-library.36530/#post-214687 Click to expand... Thanks. Looks like I have a choice of two libraries of string functions, MLStr and Margret's String Functions, plus the built in stuff. That should stop me having to reinvent too many wheels. John