public class StringFunctions extends Object
java.lang.String
. These methods in the class java.lang.String
are not static and therefore need a String object to work on. The wrapper
methods are static and take the first argument as the String object to work
on. In other words if in Java you would write
s.xyz(parameterlist)to call the method
xyz()
then in BASIC you will be able to call
xyz(s, parameterlist)
The documentation of the methods implemented in java.langString
are
not repeared here. Other methods, that implement BASIC like string functions
not implemented in the class java.lang.String
are documented in this
class.
Constructor and Description |
---|
StringFunctions() |
Modifier and Type | Method and Description |
---|---|
static String |
charAt(String s1,
int i)
Returns a one character string that contains the character that is at the
position
i in the string s1 . |
static String |
chomp(String s)
Chop off the new line character(s) from the end of the string.
|
static int |
codePointAt(String s1,
int i) |
static int |
codePointBefore(String s1,
int i) |
static int |
codePointCount(String s1,
int i,
int j) |
static int |
compareTo(String s1,
String s2) |
static int |
compareToIgnoreCase(String s1,
String s2) |
static boolean |
contains(String s1,
String s2) |
static boolean |
endsWith(String s1,
String s2) |
static Long |
index(String s1,
String s2)
Implements the functionality of the method
s1.indexOf(s2) |
static Long |
indexAfter(String s1,
String s2,
int i)
Implements the functionality of the method
s1.indexOf(s2,i) |
static boolean |
isEmpty(String s1) |
static Long |
lastIndex(String s1,
String s2)
Implements the functionality of the method
s1.lastIndexOf(s2) |
static Long |
lastIndexAfter(String s1,
String s2,
int i)
Implements the functionality of the method
s1.lastIndexOf(s2,i) |
static String |
lcase(String s)
Return a string lower cased.
|
static String |
ltrim(String s)
Trim the white spaces from the start of the string.
|
static String |
mid(String s,
int start,
int len)
Return a substring from the string that starts at the position
start and has a length of len . |
static String |
replaceAll(String s1,
String regex,
String s2) |
static String |
replaceFirst(String s1,
String regex,
String s2) |
static String |
right(String s,
int len)
Return
len number of characters from the right (the end) of the
string. |
static String |
rtrim(String s)
Trim the white spaces from the end of the string.
|
static String |
space(int len)
Return a string that is
len number of space characters. |
static boolean |
startsWith(String s1,
String s2) |
static String |
string(int len,
String s)
Return a string that is
len times the character in s . |
static int |
strlen(String s1) |
static String |
strreverse(String s)
Return a string with the characters reversed.
|
static String |
trim(String s) |
static String |
ucase(String s)
Return a string upper cased.
|
public static String chomp(String s)
If there are no new line characters at the end of the string then the unaltered string is returned.
s
- the string to chomppublic static String ltrim(String s)
s
- the string to trim.public static String rtrim(String s)
s
- the string to trimpublic static String mid(String s, int start, int len)
start
and has a length of len
.s
- start
- len
- public static String right(String s, int len)
len
number of characters from the right (the end) of the
string.s
- len
- public static String space(int len)
len
number of space characters.len
- public static String string(int len, String s)
len
times the character in s
. If
the string s
contains more than one characters then only the
first character is repeated.len
- s
- public static String strreverse(String s)
s
- public static Long index(String s1, String s2)
s1.indexOf(s2)
s1
- s2
- public static Long lastIndex(String s1, String s2)
s1.lastIndexOf(s2)
s1
- s2
- public static Long indexAfter(String s1, String s2, int i)
s1.indexOf(s2,i)
s1
- s2
- i
- public static Long lastIndexAfter(String s1, String s2, int i)
s1.lastIndexOf(s2,i)
s1
- s2
- i
- public static String charAt(String s1, int i)
i
in the string s1
.s1
- i
- public static int strlen(String s1)
s1
- public static int codePointAt(String s1, int i)
public static int codePointBefore(String s1, int i)
public static int codePointCount(String s1, int i, int j)
public static boolean isEmpty(String s1)
Copyright © 2013 Verhas and Verhas Software Craftsmen. All Rights Reserved.