cout << "Output From  SamplePrintWordWithBreak() \n\n"; cout << "[" << NS_LossyConvertUCS2toASCII(result).get() << "]\n";
printf("Output From  SamplePrintWordWithBreak() \n\n"); printf("[%s]\n", NS_LossyConvertUCS2toASCII(result).get());
void SamplePrintWordWithBreak(){   PRUint32 numOfFragment = sizeof(wb) / sizeof(char*);   nsIWordBreakerFactory *t = NULL;   nsresult res = nsServiceManager::GetService(kLWBrkCID,                                kIWordBreakerFactory,                                (nsISupports**) &t);   nsIWordBreaker *wbk;   nsAutoString wb_arg;   res = t->GetBreaker(wb_arg, &wbk);   nsAutoString result;   nsAutoString tmp;   for(PRUint32 i = 0; i < numOfFragment; i++)   {      nsAutoString fragText; fragText.AssignWithConversion(wb[i]);       // nsBreakState bk(fragText.get(), fragText.Length());      PRUint32 cur = 0;      PRBool done;      res = wbk->NextWord(fragText.get(), fragText.Length(), cur, &cur, &done);      PRUint32 start = 0;      for(PRUint32 j = 0; ! done ; j++)      {            tmp.Truncate();            fragText.Mid(tmp, start, cur - start);            result.Append(tmp);            result.Append(NS_LITERAL_STRING("^"));            start = cur;            wbk->NextWord(fragText.get(), fragText.Length(), cur, &cur, &done);      }      tmp.Truncate();      fragText.Mid(tmp, start, fragText.Length() - start);      result.Append(tmp);      if( i != (numOfFragment -1 ))      {        nsAutoString nextFragText; nextFragText.AssignWithConversion(wb[i+1]);         PRBool canBreak = PR_TRUE;        res = wbk->BreakInBetween( fragText.get(),                                   fragText.Length(),                                  nextFragText.get(),                                   nextFragText.Length(),                                  &canBreak                                );        if(canBreak)            result.Append(NS_LITERAL_STRING("^"));        fragText = nextFragText;      }   }   cout << "Output From  SamplePrintWordWithBreak() \n\n";   cout << "[" << NS_LossyConvertUCS2toASCII(result).get() << "]\n";}