Package overit.geocall.util
Class SizedString
java.lang.Object
overit.geocall.util.SizedString
This class implements a fixed length string filled with a character or a string
that is named
"base". The "base" can be overwritten
partly or totally by a string, which can be inserted in any position. To implement
this class we use the StringBuffer; This class includes two constructors:
one to create the "base" with a single character and one with a string.
Furthermore the method to print the result is overwritten.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSizedString(String s, char c, int dim, int pos) The constructor to create the"base"string of size equal to the parameter passed and filled with a same character.
The"base"string is overwritten by a string that can be placed in any index of the string.SizedString(String s, String base, int pos) The constructor to create the"base"string using the string passed as second parameter.
The"base"string is overwritten by a string that can be placed in any index of the string. -
Method Summary
-
Field Details
-
_sb
-
-
Constructor Details
-
SizedString
The constructor to create the"base"string of size equal to the parameter passed and filled with a same character.
The"base"string is overwritten by a string that can be placed in any index of the string. If overwriting exceeds the length of the"base"string, it is truncated.
Examples to clarify the use of the last parameter indicating the position of the string to be used in overwriting:
Examples new SizedString("****", '1', 10, 0)"****111111"new SizedString("****", '1', 10, 9)"111111111*"new SizedString("****", '1', 10, -1)"111111****"new SizedString("****", '1', 10, -10)"*111111111"- Parameters:
s- The string to use to overwrite the"base"c- The character to use to fill the"base"dim- The length of the"base"pos- The index to position the string to be used in overwriting. It can be positive or negative. If it is positive, the starting index is indicated (where to start the string from the first character of the"base"the position to indicate is"0", instead to make it start from the last character the position is"length-1"). If it is negative, the index of the string end is indicated (where to end the string at the first character of the"base"the position to indicate is"-length", insted to make it end from the last character th position is"-1").
-
SizedString
The constructor to create the"base"string using the string passed as second parameter.
The"base"string is overwritten by a string that can be placed in any index of the string. If overwriting exceeds the length of the"base"string, it is truncated.
Examples to clarify the use of the last parameter indicating the position of the string to be used in overwriting:
Examples new SizedString("****", "0123456789", 10, 0)"****456789"new SizedString("****", "0123456789", 10, 9)"012345678*"new SizedString("****", "0123456789", 10, -1)"012345****"new SizedString("****", "0123456789", 10, -10)"*123456789"- Parameters:
s- The string to use to overwrite the"base"base- The string to use as"base"pos- The index to position the string to be used in overwriting. It can be positive or negative. If it is positive, the starting index is indicated (where to start the string from the first character of the"base"the position to indicate is"0", instead to make it start from the last character the position is"length-1"). If it is negative, the index of the string end is indicated (where to end the string at the first character of the"base"the position to indicate is"-length", insted to make it end from the last character th position is"-1").
-
-
Method Details