Here you can find the source of toJavaString(final String s)
static public String toJavaString(final String s)
//package com.java2s; /********************************************************************************************* * * * 'StringUtils.java', in plugin 'msi.gama.core', is part of the source code of the * GAMA modeling and simulation platform. * (c) 2007-2014 UMI 209 UMMISCO IRD/UPMC & Partners * * Visit https://code.google.com/p/gama-platform/ for license information and developers contact. * * **********************************************************************************************/ public class Main { static public String toJavaString(final String s) { if (s == null) { return null; }// ww w. j a v a 2 s . co m String t = s.trim(); if (!isGamaString(t)) { return s; } if (t.length() >= 2) { return t.substring(1, t.length() - 1); } return s; } static public boolean isGamaString(final String s) { if (s == null) { return false; } int n = s.length(); if (n == 0 || n == 1) { return false; } if (s.charAt(0) != '\'') { return false; } if (s.charAt(n - 1) != '\'') { return false; } return true; } }