[Gambas-user] non printable char "Ⱶ" how to remove from string!!!!!

Ru Vuott vuott at ...325...
Thu Dec 24 03:17:57 CET 2015


If the problematic character is > 127, you could use IsAscii() function:

Public Sub Main()

  Dim s As String = "abcd efg" & Chr(195) & "hil mnop"
  Dim bb As Byte[]
  Dim b As Byte
  Dim i As Integer

    Print s
    
    With bb = Byte[].FromString(s)
      i = .Count
    End With
    
    While b < i
      If Not IsAscii(Chr(bb[b])) Then bb[b] = 32
        Dec i
        Inc b
    Wend
    
    s = bb.ToString(0, bb.count)
    
    Print s

End









--------------------------------------------
Mer 23/12/15, PICCORO McKAY Lenz <mckaygerhard at ...626...> ha scritto:

 Oggetto: Re: [Gambas-user]	non printable char "Ⱶ" how to remove from string!!!!!
 A: "mailing list for gambas users" <gambas-user at lists.sourceforge.net>
 Data: Mercoledì 23 dicembre 2015, 20:14
 
 i resend the char
 discovered by me, and the returnet by asc 195 and not the
 same..
 
 in any
 of the case i workaround using predefined constants and
 removing
 "extra" bytes from the
 string.. there's no way to detect that char from a
 serial device... must be a bug in the
 printer..
 
 thanks all for
 help
 
 Lenz McKAY Gerardo
 (PICCORO)
 http://qgqlochekone.blogspot.com
 
 2015-12-23 12:16 GMT-04:30
 Charlie <charlie at ...2793...>:
 
 > Have a look at this code,
 note that the "Ⱶ" character is Chr(195) see 
 here
 > <http://www.asciitable.com/>
 > *Public Sub form_Open()
 > Dim sString As String
 >
 sString = Chr(195) & "Hello World" &
 Chr(195)
 > Print sString
 > sString = Replace(sString, Chr(195),
 "")
 > Print sString
 > End*
 >
 >
 >
 >
 --
 > View this message in context:
 > http://gambas.8142.n7.nabble.com/non-printable-char-how-to-remove-from-string-tp55078p55084.html
 > Sent from the gambas-user mailing list
 archive at Nabble.com.
 >
 >
 ------------------------------------------------------------------------------
 >
 _______________________________________________
 > Gambas-user mailing list
 > Gambas-user at lists.sourceforge.net
 > https://lists.sourceforge.net/lists/listinfo/gambas-user
 >
 ------------------------------------------------------------------------------
 _______________________________________________
 Gambas-user mailing list
 Gambas-user at lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/gambas-user




More information about the User mailing list