M msfactory Member Licensed User Longtime User Aug 16, 2013 #1 I'm sorry It has posted using the translation software so I can not speak English I do not know how to convert to int array from a string array I want to know is the way! This code, the following error will appear java.lang.NumberFormatException: Invalid double: "" Sub test Dim text As String Dim b(100) As Int Dim a(100) As String text = "_ABC_DEF_GHI_JKL_MNO ・・・・・・・・・・・・・・・・・・・・" a =Regex.Split("_",text) For i = 0 To a.Length -1 b(i) = a(i) Next End Sub
I'm sorry It has posted using the translation software so I can not speak English I do not know how to convert to int array from a string array I want to know is the way! This code, the following error will appear java.lang.NumberFormatException: Invalid double: "" Sub test Dim text As String Dim b(100) As Int Dim a(100) As String text = "_ABC_DEF_GHI_JKL_MNO ・・・・・・・・・・・・・・・・・・・・" a =Regex.Split("_",text) For i = 0 To a.Length -1 b(i) = a(i) Next End Sub
M Mahares Expert Licensed User Longtime User Aug 16, 2013 #2 You cannot store a string in an integer array when some of the elements are strings. If, for instance you have this: text ="1_876_721_35", then it will work because all elements are numbers. This works: Code: Copy Dim text AString Dim b(100) As Int Dim a(100) As String text ="1_876_721_35" a =Regex.Split("_",text) For i = 0 To a.Length -1 b(i) = a(i) Log(b(i)) Next This will also work: Code: Copy Dim text As String Dim b(100) As Int Dim a(100) As String text = "_ABC_DEF_GHI_JKL_MNO" a =Regex.Split("_",text) For i = 0 To a.Length -1 b(i) = a(i).Length Log(b(i)) Next Upvote 0
You cannot store a string in an integer array when some of the elements are strings. If, for instance you have this: text ="1_876_721_35", then it will work because all elements are numbers. This works: Code: Copy Dim text AString Dim b(100) As Int Dim a(100) As String text ="1_876_721_35" a =Regex.Split("_",text) For i = 0 To a.Length -1 b(i) = a(i) Log(b(i)) Next This will also work: Code: Copy Dim text As String Dim b(100) As Int Dim a(100) As String text = "_ABC_DEF_GHI_JKL_MNO" a =Regex.Split("_",text) For i = 0 To a.Length -1 b(i) = a(i).Length Log(b(i)) Next
M msfactory Member Licensed User Longtime User Aug 16, 2013 #3 Hello Mahares Thank you for answers The code, and it worked exactly as I want Thank you very much! Upvote 0