"John, Tiña, Will"
list = "John, Tiña, Will"
regex = CreateObject("roRegex", ",", "") ' split on comma
print regex.Split(list)
"kyleabaker" wrote:
Actually, the roku doesn't even display those characters on screen? For example: "ü"
Is this a bug? Can I at least replace all of these characters so they display? Like "ü" --> "u"?
"kyleabaker" wrote:
Can I at least replace all of these characters so they display? Like "ü" --> "u"?
function asciiConverter () as object
this = {}
this.lookup = CreateObject ("roArray", 256, false)
' Do not convert characters that are already ASCII
for i = 0 to 127
this.lookup [i] = i
end for
' Map the remaining ANSI chars to a default "invalid" ASCII character
for i = 128 to 255
this.lookup [i] = Asc ("?")
end for
' Add characters to be converted
this.lookup [241] = Asc ("n") ' n tilde
this.lookup [252] = Asc ("u") ' u tilde
' etc ....
' Conversion function
this.ToAscii = function (data as string) as string
baIn = CreateObject ("roByteArray")
baOut = CreateObject ("roByteArray")
baIn.FromAsciiString (data)
for each ch in baIn
baOut.Push (m.lookup [ch])
end for
return baOut.ToAsciiString ()
end function
return this
end function
' Example usage
ac = asciiConverter ()
strConverted = ac.ToAscii ("Hello" + Chr (241) + Chr (252))
print strConverted
"kyleabaker" wrote:
The following code works without the special "ñ", but not with. Am I doing something wrong with the regex here?
list = "John, Tiña, Will"
regex = CreateObject("roRegex", ",", "") ' split on comma
print regex.Split(list)
regex = CreateObject("roRegex", ",", "")
l = regex.Split("John, Tiña, Will")
? l
for i = 1 to len(l[1]): ch = mid(l[1], i, 1): ? i, asc(ch), ch: end for
John
Ti ?a
Will
1 32
2 84 T
3 105 i
4 241 ?
5 97 a
fileText = ReadAsciiFile(path_to_file)
r = CreateObject("roRegex", Chr(241), "") 'ñ
If (r.IsMatch(fileText)) Then
print "matched"
fileText = r.ReplaceAll(fileText, "n")
print "replaced"
End If
"kyleabaker" wrote:
... However, when reading this string from a file it is not working at all. Is ReadAsciiFile doing some manipulation to the text?