Re: [xml] iterating an UTF-8 string (xmlChar)



On Wed, Jul 13, 2005 at 02:09:56PM +0200, Roberto Diaz wrote:
Hi.

I am trying to figure out how to iterate thorught an xmlChar *.

I mean something like this:

for (unsigned int i = 0; xmlUTF8Strlen (myString); ++i)
      /// obiously this wont work
          myString[i] = ...;

How do I iterate the string?

  depends what you want to do with it

  while ( myString[i] != 0) {

      i++;
  }

  or you can use xmlGetUTF8Char() to go though each character code point
using the returned len to increment the i byte index.

Daniel
  
-- 
Daniel Veillard      | Red Hat Desktop team http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]