StringWrapper.java

  1. /*
  2.  * GovWay - A customizable API Gateway
  3.  * https://govway.org
  4.  *
  5.  * Copyright (c) 2005-2025 Link.it srl (https://link.it).
  6.  *
  7.  * This program is free software: you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License version 3, as published by
  9.  * the Free Software Foundation.
  10.  *
  11.  * This program is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  * GNU General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License
  17.  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18.  *
  19.  */

  20. package org.openspcoop2.utils;

  21. import java.util.Locale;

  22. /**
  23.  * StringWrapper
  24.  *
  25.  * @author Poli Andrea (apoli@link.it)
  26.  * @author $Author$
  27.  * @version $Rev$, $Date$
  28.  */
  29. public class StringWrapper {

  30.     private String value;
  31.    
  32.     public StringWrapper(String value){
  33.         this.value = value;
  34.     }
  35.    
  36.     public void replace(Character oldChar, Character newChar){
  37.         this.value = this.value.replace(oldChar, newChar);
  38.     }  
  39.     public void replace(CharSequence target, CharSequence replacement){
  40.         this.value = this.value.replace(target, replacement);
  41.     }  
  42.     public void replaceAll(String regex, String replacement){
  43.         this.value = this.value.replaceAll(regex, replacement);
  44.     }  
  45.     public void replaceFirst(String regex, String replacement){
  46.         this.value = this.value.replaceFirst(regex, replacement);
  47.     }
  48.    
  49.    
  50.     public void substring(int beginIndex){
  51.         this.value = this.value.substring(beginIndex);
  52.     }
  53.     public void substring(int beginIndex, int endIndex){
  54.         this.value = this.value.substring(beginIndex, endIndex);
  55.     }
  56.    
  57.    
  58.     public void toLowerCase(){
  59.         this.value = this.value.toLowerCase();
  60.     }
  61.     public void toLowerCase(Locale locale){
  62.         this.value = this.value.toLowerCase(locale);
  63.     }
  64.    
  65.     public void toUpperCase(){
  66.         this.value = this.value.toUpperCase();
  67.     }
  68.     public void toUpperCase(Locale locale){
  69.         this.value = this.value.toUpperCase(locale);
  70.     }
  71.    
  72.    
  73.     public void concat(String str){
  74.         this.value = this.value.concat(str);
  75.     }
  76.    
  77.    
  78.     public void trim(){
  79.         this.value = this.value.trim();
  80.     }
  81.    
  82.    
  83.     @Override
  84.     public String toString(){
  85.         return this.value;
  86.     }
  87. }