By converting it into UTF8 String, you can do as follows
System.out.println("Query:\n" + query);
        Vector<String> queries = new Vector();
        try {
            query = URLEncoder.encode(query, "UTF8");
            System.out.println("Encoded: " + query);
        } catch (UnsupportedEncodingException ex) {
           
Logger.getLogger(ResultSetTable.class.getName()).log(Level.SEVERE, null,
ex);
        }


        String[] list = query.split("%3B%0D%0A");
        System.out.println(list.length + " queries found in the input");
     
        for (int i = 0; i < list.length; i++) {
            String q = list[i];
            
            System.out.println("query: " + q);
            try {
                q = URLDecoder.decode(q, "UTF8");
                System.out.println("Decoded: " + q);
                if(q!= null){
                    q = q.trim();
                    
                }
            } catch (UnsupportedEncodingException ex) {
               
Logger.getLogger(ResultSetTable.class.getName()).log(Level.SEVERE, null,
ex);
            }
            queries.add(q);

=========================

TIMMERMAN Craig wrote:
> 
> Hello,
>  
> I have been searching for a solution and haven't seen anything yet, here
> is the problem:
>  
> I have a string that contains values separated by new line characters.
> Is there any way to split the string into an array?  I've tried 
>  
> #set( $aStringArray = $Property1.split("\n") )
>  
> but it doesn't seem to understand the new line character.  Is there any
> way to do this?
>  
> Thanks.
>  
> 
> 

-- 
View this message in context: 
http://www.nabble.com/split-a-string-on-newline-tp15069810p22949728.html
Sent from the Velocity - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to