BAEL-838 Initial code showing how to remove last char - helper class and tests.
(cherry picked from commit d889dba)
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package com.baeldung.string;
|
||||
|
||||
/**
|
||||
* @author iaforek
|
||||
*
|
||||
*/
|
||||
public class RemoveLastChar {
|
||||
public static String substring (String s) {
|
||||
if (s == null || s.length() == 0) {
|
||||
return null;
|
||||
} else {
|
||||
return (s.substring(0, s.length() - 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user