Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

String Samples (See related posts)

String samples
  
     System.setProperty("file.encoding","UTF-8") 
     System.setProperty("file.encoding","CP850")
     def delimiters = [:]

     //String data = new String((byte[])"é():;éééçç,.<>[]","UTF-8");

     def data =   "é():;éùùçç,.<>[]" 
     
     data = data.replace('é', 'e');
     println data
     println data.size()
     
     data.each { c ->
        // def str = Long.toHexString(c as long)
       def str = c
       //  if (!(c =~ /\w/)) {
         if (c == 'é') {
        	delimiters[c] = "Annul\u00E7e"
         }
         else if(c == 'ù') {
        	 delimiters[c] = "\u00E7"
         }         
         else
         {
        	 delimiters[c] = str
         }
     }
     println delimiters

You need to create an account or log in to post comments to this site.