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

Ru Vuott vuott at ...325...
Thu Dec 24 03:26:49 CET 2015


opsss.. only a little adjustment:

******************************************************************
Public Sub Main()

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

    Print s
    
    bb = Byte[].FromString(s)
    
    For b = 0 To bb.Max
      If Not IsAscii(Chr(bb[b])) Then bb[b] = 32
    Next
    
    s = bb.ToString(0, bb.count)
    
    Print s

End
**********************************************************


or if you want to "remove":


 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.Remove(b)
         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
 
 ------------------------------------------------------------------------------
 _______________________________________________
 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