asales Expert Licensed User Longtime User Aug 17, 2020 #1 I have this string: 6%>$#2"$6;2$0:6>;y48: But If I try to make this: B4X: Dim s As String = "6%>$#2"$6;2$0:6>;y48:" I get this error message in the IDE: The input string was not in the correct format. It is because the apostrophe, but has the $ caracter after it and don't work if I make this: B4X: Dim s As String = $"6%>$#2"$6;2$0:6>;y48:"$ How can I fix this? Thanks in advance for any tip.
I have this string: 6%>$#2"$6;2$0:6>;y48: But If I try to make this: B4X: Dim s As String = "6%>$#2"$6;2$0:6>;y48:" I get this error message in the IDE: The input string was not in the correct format. It is because the apostrophe, but has the $ caracter after it and don't work if I make this: B4X: Dim s As String = $"6%>$#2"$6;2$0:6>;y48:"$ How can I fix this? Thanks in advance for any tip.
MicroDrie Well-Known Member Licensed User Longtime User Aug 17, 2020 #2 The $ character is used in the literal string for entering a variable. So make a string with the $ character and refer to it like this: Use of $ character in string: Dim str As String = "$" Dim s As String = $"6%>${str}#2"${str}6;2${str}0:6>;y48:"$ Log(s) Upvote 0
The $ character is used in the literal string for entering a variable. So make a string with the $ character and refer to it like this: Use of $ character in string: Dim str As String = "$" Dim s As String = $"6%>${str}#2"${str}6;2${str}0:6>;y48:"$ Log(s)
M Mahares Expert Licensed User Longtime User Aug 18, 2020 #3 Here is another weird way of doing it and it works: B4X: Dim str As String=$"6%>$#2" $6;2$0:6>;y48:"$ str=str.Replace(" ","") Log(str) 'displays: 6%>$#2"$6;2$0:6>;y48: Last edited: Aug 18, 2020 Upvote 0
Here is another weird way of doing it and it works: B4X: Dim str As String=$"6%>$#2" $6;2$0:6>;y48:"$ str=str.Replace(" ","") Log(str) 'displays: 6%>$#2"$6;2$0:6>;y48:
Erel B4X founder Staff member Licensed User Longtime User Aug 18, 2020 #5 MicroDrie said: he $ character is used in the literal string for entering a variable Click to expand... Not 100% accurate. The problem is with "$, which is the smart string terminator sequence. A $ alone will not need to be escaped. Two more options: B4X: Dim s As String = $"6%>$#2"${"$"}6;2$0:6>;y48:"$ 'add the $ with a placeholder. Dim s As String = "6%>$#2""$6;2$0:6>;y48:" 'double quotes Upvote 0
MicroDrie said: he $ character is used in the literal string for entering a variable Click to expand... Not 100% accurate. The problem is with "$, which is the smart string terminator sequence. A $ alone will not need to be escaped. Two more options: B4X: Dim s As String = $"6%>$#2"${"$"}6;2$0:6>;y48:"$ 'add the $ with a placeholder. Dim s As String = "6%>$#2""$6;2$0:6>;y48:" 'double quotes