Olaan Expert Licensed User Longtime User Dec 26, 2024 #1 Refer to this ,Where can I get StringBuilder libraries for B4A,B4J,and B4i? Ithink B4Aversion13 there isn't thelibrary Last edited: Dec 26, 2024
Refer to this ,Where can I get StringBuilder libraries for B4A,B4J,and B4i? Ithink B4Aversion13 there isn't thelibrary
Solution Olaan Dec 28, 2024 Everything is Ok.My problem is solved fromEmexes'scode and Aeric'scode. Let me explain my problem. There are 2 points of problem. Magret's code, there isn't Split2 and return array of string(her code has only split which return list. so B4A told that itcan't found StringBuilder.jar and another Point, Aeric's example about"\." which is different from VB6.0 coding. The helping of Emexe's code, it can be solved the problem.
Everything is Ok.My problem is solved fromEmexes'scode and Aeric'scode. Let me explain my problem. There are 2 points of problem. Magret's code, there isn't Split2 and return array of string(her code has only split which return list. so B4A told that itcan't found StringBuilder.jar and another Point, Aeric's example about"\." which is different from VB6.0 coding. The helping of Emexe's code, it can be solved the problem.
Sagenut Expert Licensed User Longtime User Dec 26, 2024 #2 StringBuilder it's a Core function. Simply declare something like B4X: Copy Dim sb as StringBuilder and it will work in B4A, B4J and B4i. It does not need any library to be ticked. Upvote 0
StringBuilder it's a Core function. Simply declare something like B4X: Copy Dim sb as StringBuilder and it will work in B4A, B4J and B4i. It does not need any library to be ticked.
Olaan Expert Licensed User Longtime User Dec 26, 2024 #3 Sagenut said: StringBuilder it's a Core function. Simply declare something like B4X: Copy Dim sb as StringBuilder and it will work in B4A, B4J and B4i. It does not need any library to be ticked. Click to expand... I B4A version13 , I search the library Under the AnywhereSoftware folder. I can't find it. There isn't StringBuilder.jar Upvote 0
Sagenut said: StringBuilder it's a Core function. Simply declare something like B4X: Copy Dim sb as StringBuilder and it will work in B4A, B4J and B4i. It does not need any library to be ticked. Click to expand... I B4A version13 , I search the library Under the AnywhereSoftware folder. I can't find it. There isn't StringBuilder.jar
Sagenut Expert Licensed User Longtime User Dec 26, 2024 #4 Theera said: I B4A version13 , I search the library Under the AnywhereSoftware folder. I can't find it. There isn't StringBuilder.jar Click to expand... There is no library for it. It's included in the Core library that is always ticked as default. Try writing something like in this image and you will find it in the suggestions. I used "sb" as StringBuilder abbreviation, but you can declare the variable with any name you like of course. Upvote 0
Theera said: I B4A version13 , I search the library Under the AnywhereSoftware folder. I can't find it. There isn't StringBuilder.jar Click to expand... There is no library for it. It's included in the Core library that is always ticked as default. Try writing something like in this image and you will find it in the suggestions. I used "sb" as StringBuilder abbreviation, but you can declare the variable with any name you like of course.
Olaan Expert Licensed User Longtime User Dec 27, 2024 #5 Why my project still has error code? Attachments error.png 6.9 KB · Views: 526 TestB4XStringFunctionVB2.zip TestB4XStringFunctionVB2.zip 18.6 KB · Views: 343 Upvote 0
Alexander Stolte Expert Licensed User Longtime User Dec 27, 2024 #6 Theera said: Why my project still has error code? Click to expand... Close the project and open it again, then try it again Upvote 0
Theera said: Why my project still has error code? Click to expand... Close the project and open it again, then try it again
E emexes Expert Licensed User Longtime User Dec 27, 2024 #7 Theera said: Why my project still has error code? Click to expand... Equivalent Core function Regex.Split works fine: (plus note that you don't need to specify array size eg what would happen for MyTargetMoney "1.2.3" ? ) Code: Copy Dim MyTargetMoney As String="1234.75" If MyTargetMoney.Contains(".") Then '''Dim arrNum(2) As String =sf.Split(MyTargetMoney,".") Dim arrNum() As String = Regex.Split("\.", MyTargetMoney) '// บาท strBaht =arrNum(0) '// สตางค์ strStang= arrNum(1) Log(strBaht & " บาท, " & strStang & " สตางค") End If Code: Copy Waiting for debugger to connect... Program stared. 1234 บาท, 75 สตางค Upvote 0
Theera said: Why my project still has error code? Click to expand... Equivalent Core function Regex.Split works fine: (plus note that you don't need to specify array size eg what would happen for MyTargetMoney "1.2.3" ? ) Code: Copy Dim MyTargetMoney As String="1234.75" If MyTargetMoney.Contains(".") Then '''Dim arrNum(2) As String =sf.Split(MyTargetMoney,".") Dim arrNum() As String = Regex.Split("\.", MyTargetMoney) '// บาท strBaht =arrNum(0) '// สตางค์ strStang= arrNum(1) Log(strBaht & " บาท, " & strStang & " สตางค") End If Code: Copy Waiting for debugger to connect... Program stared. 1234 บาท, 75 สตางค
Olaan Expert Licensed User Longtime User Dec 27, 2024 #8 Alexander Stolte said: Close the project and open it again, then try it again Click to expand... No only close the project but close computer ,it still be errored I think I will reinstall B4A again Upvote 0
Alexander Stolte said: Close the project and open it again, then try it again Click to expand... No only close the project but close computer ,it still be errored I think I will reinstall B4A again
E emexes Expert Licensed User Longtime User Dec 27, 2024 #9 Theera said: I will reinstall B4A again Click to expand... Seems a bit extreme. Did you try make your own StringBuilder library, to replace the StringBuilder that is built-in (Core) to B4X? Maybe get rid of that first. For what it's worth: I have both B4J and B4A installed and working, including StringBuilder, and there is no stringbuilder.jar file on any of my drives. Upvote 0
Theera said: I will reinstall B4A again Click to expand... Seems a bit extreme. Did you try make your own StringBuilder library, to replace the StringBuilder that is built-in (Core) to B4X? Maybe get rid of that first. For what it's worth: I have both B4J and B4A installed and working, including StringBuilder, and there is no stringbuilder.jar file on any of my drives.
Olaan Expert Licensed User Longtime User Dec 27, 2024 #10 emexes said: Seems a bit extreme. Did you try make your own StringBuilder library, to replace the StringBuilder that is built-in (Core) to B4X? Maybe get rid of that first. For what it's worth: I have both B4J and B4A installed and working, and there is no StringBuilder.jar file on any of my drives. Click to expand... I'm downloading B4A, Perhaps my problemwill be solved. Thank you all of you.If it still be error.I think I try to create a small libraryfor test again. Upvote 0
emexes said: Seems a bit extreme. Did you try make your own StringBuilder library, to replace the StringBuilder that is built-in (Core) to B4X? Maybe get rid of that first. For what it's worth: I have both B4J and B4A installed and working, and there is no StringBuilder.jar file on any of my drives. Click to expand... I'm downloading B4A, Perhaps my problemwill be solved. Thank you all of you.If it still be error.I think I try to create a small libraryfor test again.
Olaan Expert Licensed User Longtime User Dec 27, 2024 #11 I think my problem alike his problem Thread 'Library CsBuilder !!' https://www.b4x.com/android/forum/threads/library-csbuilder.81178/ Upvote 0
I think my problem alike his problem Thread 'Library CsBuilder !!' https://www.b4x.com/android/forum/threads/library-csbuilder.81178/
Olaan Expert Licensed User Longtime User Dec 27, 2024 #12 emexes said: Equivalent Core function Regex.Split works fine: (plus note that you don't need to specify array size eg what would happen for MyTargetMoney "1.2.3" ? ) Code: Copy Dim MyTargetMoney As String="1234.75" If MyTargetMoney.Contains(".") Then '''Dim arrNum(2) As String =sf.Split(MyTargetMoney,".") Dim arrNum() As String = Regex.Split("\.", MyTargetMoney) '// บาท strBaht =arrNum(0) '// สตางค์ strStang= arrNum(1) Log(strBaht & " บาท, " & strStang & " สตางค") End If Code: Copy Waiting for debugger to connect... Program stared. 1234 บาท, 75 สตางค Click to expand... Would you mind sending me your sourcecode. I don't understand your word "Replace the stringbuilder that is built-in(core) to B4X" how I do What's differ between the old and the new? Upvote 0
emexes said: Equivalent Core function Regex.Split works fine: (plus note that you don't need to specify array size eg what would happen for MyTargetMoney "1.2.3" ? ) Code: Copy Dim MyTargetMoney As String="1234.75" If MyTargetMoney.Contains(".") Then '''Dim arrNum(2) As String =sf.Split(MyTargetMoney,".") Dim arrNum() As String = Regex.Split("\.", MyTargetMoney) '// บาท strBaht =arrNum(0) '// สตางค์ strStang= arrNum(1) Log(strBaht & " บาท, " & strStang & " สตางค") End If Code: Copy Waiting for debugger to connect... Program stared. 1234 บาท, 75 สตางค Click to expand... Would you mind sending me your sourcecode. I don't understand your word "Replace the stringbuilder that is built-in(core) to B4X" how I do What's differ between the old and the new?
E emexes Expert Licensed User Longtime User Dec 27, 2024 #13 Theera said: Would you mind sending me your sourcecode. Click to expand... No worries (other than I already have). Here it is, this time: 1/ also with the B4J AppStart Sub lines around it so that you can see where it goes in the program code, 2/ leaving in the New Project "Hello World" example line, and 3/ using StringBuilder to construct the output Log line (instead of using string concatenation & operator) edit: NO extra libraries are needed; Regex and StringBuilder are Core (built-in) objects = no need to tick anything extra in the Library Manager tab Code: Copy Sub AppStart (Args() As String) '''Log("Hello world!!!") Dim MyTargetMoney As String="1234.75" If MyTargetMoney.Contains(".") Then '''Dim arrNum(2) As String =sf.Split(MyTargetMoney,".") Dim arrNum() As String = Regex.Split("\.", MyTargetMoney) 'use Regex.Split to split one big string into smaller strings '// บาท strBaht =arrNum(0) '// สตางค์ strStang= arrNum(1) Dim sb As StringBuilder 'use StringBuilder to join many small strings into one big string sb.Initialize sb.Append(strBaht) sb.Append(" บาท, ") sb.Append(strStang) sb.Append(" สตางค") Log(sb.ToString) End If End Sub Code: Copy Waiting for debugger to connect... Program started. 1234 บาท, 75 สตางค Program terminated (StartMessageLoop was not called). Upvote 0
Theera said: Would you mind sending me your sourcecode. Click to expand... No worries (other than I already have). Here it is, this time: 1/ also with the B4J AppStart Sub lines around it so that you can see where it goes in the program code, 2/ leaving in the New Project "Hello World" example line, and 3/ using StringBuilder to construct the output Log line (instead of using string concatenation & operator) edit: NO extra libraries are needed; Regex and StringBuilder are Core (built-in) objects = no need to tick anything extra in the Library Manager tab Code: Copy Sub AppStart (Args() As String) '''Log("Hello world!!!") Dim MyTargetMoney As String="1234.75" If MyTargetMoney.Contains(".") Then '''Dim arrNum(2) As String =sf.Split(MyTargetMoney,".") Dim arrNum() As String = Regex.Split("\.", MyTargetMoney) 'use Regex.Split to split one big string into smaller strings '// บาท strBaht =arrNum(0) '// สตางค์ strStang= arrNum(1) Dim sb As StringBuilder 'use StringBuilder to join many small strings into one big string sb.Initialize sb.Append(strBaht) sb.Append(" บาท, ") sb.Append(strStang) sb.Append(" สตางค") Log(sb.ToString) End If End Sub Code: Copy Waiting for debugger to connect... Program started. 1234 บาท, 75 สตางค Program terminated (StartMessageLoop was not called).
Sagenut Expert Licensed User Longtime User Dec 27, 2024 #14 Theera said: I think my problem alike his problem Thread 'Library CsBuilder !!' https://www.b4x.com/android/forum/threads/library-csbuilder.81178/ Click to expand... That thread is from 2017. Your problem is something different. I think that you don't have any problems with B4A, you are just missing some steps and complicating an easy thing. Try the code from @emexes starting a new clean project. Understand it and then, if you see that it work, try to add it to your project. Upvote 0
Theera said: I think my problem alike his problem Thread 'Library CsBuilder !!' https://www.b4x.com/android/forum/threads/library-csbuilder.81178/ Click to expand... That thread is from 2017. Your problem is something different. I think that you don't have any problems with B4A, you are just missing some steps and complicating an easy thing. Try the code from @emexes starting a new clean project. Understand it and then, if you see that it work, try to add it to your project.
E emexes Expert Licensed User Longtime User Dec 27, 2024 #15 Theera said: I don't understand your word "Replace the stringbuilder that is built-in(core) to B4X" how I do Click to expand... I agree: even I don't understand it when half of the sentence is left off. What I wrote (asked) was: emexes said: Did you try make your own StringBuilder library, to replace the StringBuilder that is built-in (Core) to B4X? Click to expand... The error message you showed us was: which is looking for a library called stringbuilder(.jar) which is not required by and does not exist in a standard B4J or B4A installation (at least, not the ones on my computer here). So it appears like you are trying to create a new library called stringbuilder, and confusing the B4A/B4J compiler... and me too. If you are creating a new library, give it a different name, and especially not a name that clashes with existing Core elements. Perhaps call it NewAndImprovedStringBuilderByTheera so that it is impossible for B4A/B4J to confuse it with the built-in (Core) StringBuilder. Last edited: Dec 27, 2024 Upvote 0
Theera said: I don't understand your word "Replace the stringbuilder that is built-in(core) to B4X" how I do Click to expand... I agree: even I don't understand it when half of the sentence is left off. What I wrote (asked) was: emexes said: Did you try make your own StringBuilder library, to replace the StringBuilder that is built-in (Core) to B4X? Click to expand... The error message you showed us was: which is looking for a library called stringbuilder(.jar) which is not required by and does not exist in a standard B4J or B4A installation (at least, not the ones on my computer here). So it appears like you are trying to create a new library called stringbuilder, and confusing the B4A/B4J compiler... and me too. If you are creating a new library, give it a different name, and especially not a name that clashes with existing Core elements. Perhaps call it NewAndImprovedStringBuilderByTheera so that it is impossible for B4A/B4J to confuse it with the built-in (Core) StringBuilder.
E emexes Expert Licensed User Longtime User Dec 27, 2024 #16 If you step back one level, and describe the original problem that you are trying to solve, then we will get to the solution faster. I think the original problem challenge objective was to split a currency amount (eg 1234.75) into its major and minor components (eg baht and satang, dollars and cents, francs and centimes, pounds and pence). Is that guess in the ballpark? Upvote 0
If you step back one level, and describe the original problem that you are trying to solve, then we will get to the solution faster. I think the original problem challenge objective was to split a currency amount (eg 1234.75) into its major and minor components (eg baht and satang, dollars and cents, francs and centimes, pounds and pence). Is that guess in the ballpark?
E emexes Expert Licensed User Longtime User Dec 27, 2024 #17 I am liking Grok more and more emexes said: major and minor components Click to expand... Upvote 0
Olaan Expert Licensed User Longtime User Dec 27, 2024 #18 My target is creating B4XStringFunctionVb before order to help non-expert or man Familiarity with VB6.0 can code B4X. Therefore, it requires a command. Code: Copy Dim sf as B4XStringFunctionVb sf.initialize Dim arrNum()As String=sf.Split2(MyTargetMoney, ".") I have just found Magret's code, there is nocode return string(), so I add it in B4XStringFunctionVb as Split2(the old code Split return as list) I've have the same problem.Who could helpme resolved this problem for non-expertandme, please. (waiting for sourcecode amoment) Attachments TestB4XStringFunctionVB2.zip TestB4XStringFunctionVB2.zip 18.6 KB · Views: 322 Last edited: Dec 27, 2024 Upvote 0
My target is creating B4XStringFunctionVb before order to help non-expert or man Familiarity with VB6.0 can code B4X. Therefore, it requires a command. Code: Copy Dim sf as B4XStringFunctionVb sf.initialize Dim arrNum()As String=sf.Split2(MyTargetMoney, ".") I have just found Magret's code, there is nocode return string(), so I add it in B4XStringFunctionVb as Split2(the old code Split return as list) I've have the same problem.Who could helpme resolved this problem for non-expertandme, please. (waiting for sourcecode amoment)
aeric Expert Licensed User Longtime User Dec 27, 2024 #19 The function need to return an array instead of list. Upvote 0
Olaan Expert Licensed User Longtime User Dec 27, 2024 #20 aeric said: The function need to return an array instead of list. Click to expand... Yes, I have already created Split2 addition., but I still be occured error. Upvote 0
aeric said: The function need to return an array instead of list. Click to expand... Yes, I have already created Split2 addition., but I still be occured error.