Re: Interating over the characters in a string

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Carlo Razzeto (crazzeto_at_hotmail.com)
Date: 09/24/04


Date: Fri, 24 Sep 2004 13:24:06 -0400


"Jon Skeet [C# MVP]" <skeet@pobox.com> wrote in message
news:MPG.1bbcd392eb51b3598b4d9@msnews.microsoft.com...
>
> Although Unicode (UTF-16 in particular) allows surrogate pairs, I don't
> think that's the real problem. What exactly are you seeing?
>
> Note that your code as posted above will remove the character *before*
> the final " as well.
>
> --
> Jon Skeet - <skeet@pobox.com>
> http://www.pobox.com/~skeet
> If replying to the group, please do not mail me too

CSV Example:
12345,"Some, Text",9/18/2003

Array Values:
array[0]=>12345
array[1]=>"Some, Text"
array[2]=>"9/18/2003

The challenge, remove the " character from the begining and end of the
string ( not using string.replace() ). What doesn't seem to work:
if ( array[1][0] == '"' ) {
    array[1] = array[1].Substring( 1, array[1].length - 1 );
}
if( array[1][( array[1].length - 1 )] == '"' ) {
    array[1] = array[1].Substring( 0, array[1].length - 2 );
}



Relevant Pages

  • Re: Is WideCharToMultiByte(...) works fine If unicode char is more than 2 byte???
    ... > respect to surrogate pairs. ... So the wcslen will return 2 for a character above ... > Surely, if they are not surrogate-aware, they do NOT work on UTF-16. ... Unfortunately Unicode is no longer UCS-2. ...
    (microsoft.public.vc.mfc)
  • Re: unicode in ruby
    ... doesn't support unicode strings natively? ... (When Unix filesystems can write UTF-16 as ... to use decomposed characters instead of composed characters (e.g., ... even compress repetitive text which no encoding can. ...
    (comp.lang.ruby)
  • Re: unicode in ruby
    ... doesn't support unicode strings natively? ... put on Unix ages ago. ... (When Unix filesystems can write UTF-16 as ... translate to UTF-8 and/or follow the nonsensical POSIX rules for native ...
    (comp.lang.ruby)
  • Re: Trouble importing foreign language accents into Access 2003
    ... Unicode file. ... to only a field that has the accents, and I save it first in UTF-8, then ... I have also tried UTF-16, with and without BOM. ...
    (microsoft.public.access.externaldata)
  • Re: Case-sensitivity as option?
    ... Code points beyond 0x10FFFF cannot be encoded with UTF-16, ... it is unlikely that Unicode will ... Windows to UTF-8. ... encode them with normal surrogates. ...
    (comp.lang.forth)