public class NSString extends NSObject
| Constructor and Description |
|---|
NSString(byte[] bytes,
int startIndex,
int endIndex,
String encoding)
Creates a new NSString instance from its binary representation.
|
NSString(byte[] bytes,
String encoding)
Creates a new NSString instance from its binary representation.
|
NSString(String string)
Creates a new NSString instance with the specified content.
|
| Modifier and Type | Method and Description |
|---|---|
void |
append(NSString s)
Appends a string to this string.
|
void |
append(String s)
Appends a string to this string.
|
boolean |
boolValue()
Gets the boolean value of this string.
|
NSString |
clone()
Creates and returns a deep copy of this instance.
|
int |
compareTo(NSObject o) |
double |
doubleValue()
Gets the floating-point value (double precision) of this string.
|
boolean |
equals(Object obj) |
float |
floatValue()
Gets the floating-point value of this string.
|
String |
getContent()
Gets the string content of this instance.
|
int |
hashCode() |
int |
intValue()
Gets the integer value of this string.
|
void |
prepend(NSString s)
Prepends a string to this string.
|
void |
prepend(String s)
Prepends a string to this string.
|
void |
setContent(String c)
Sets the string content of this instance.
|
protected void |
toASCII(StringBuilder ascii,
int level)
Generates the ASCII representation of this object.
|
protected void |
toASCIIGnuStep(StringBuilder ascii,
int level)
Generates the ASCII representation of this object in the GnuStep format.
|
void |
toBinary(BinaryPropertyListWriter out)
Generates the binary representation of the object.
|
Object |
toJavaObject()
Converts this NSObject into an equivalent object of the Java Runtime Environment.
|
String |
toString() |
fromJavaObject, getLocationInformation, indent, toJavaObject, toXMLPropertyListpublic NSString(byte[] bytes,
String encoding)
throws UnsupportedEncodingException
bytes - The binary representation.encoding - The string encoding (name of the charset).UnsupportedEncodingException - When the given encoding is not supported by the JRE.String(byte[], String)public NSString(byte[] bytes,
int startIndex,
int endIndex,
String encoding)
throws UnsupportedEncodingException
bytes - An array containing the binary representation of the string.startIndex - The offset inside the array at which the string data starts.endIndex - The offset inside the array at which the string data ends.encoding - The string encoding (name of the charset).UnsupportedEncodingException - When the given encoding is not supported by the JRE.String(byte[], int, int, String)public NSString(String string)
string - The string that will be contained in the NSString.public int intValue()
public float floatValue()
public double doubleValue()
public boolean boolValue()
Examples: "YES" is true "true" is true " YES" is true "+1" is true "-9" is true " +01" is true "0" is false "false" is false "no" is false "1FALSE" is true "0TRUE" is true "FALSE1" is false
public String getContent()
public void setContent(String c)
c - The new content of this string object.public void append(NSString s)
s - The string to append.public void append(String s)
s - The string to append.public void prepend(String s)
s - The string to prepend.public void prepend(NSString s)
s - The string to prepend.public NSString clone()
NSObjectpublic Object toJavaObject()
NSObjectNSArray objects are converted to arrays.NSDictionary objects are converted to objects extending the Map class.NSSet objects are converted to objects extending the Set class.NSNumber objects are converted to primitive number values (int, long, double or boolean).NSString objects are converted to String objects.NSData objects are converted to byte arrays.NSDate objects are converted to Date objects.UID objects are converted to byte arrays.toJavaObject in class NSObjectpublic void toBinary(BinaryPropertyListWriter out) throws IOException
NSObjectout - The output stream to serialize the object to.IOException - If an I/O error occurs while writing to the stream or the object structure contains
data that cannot be saved.protected void toASCII(StringBuilder ascii, int level)
NSObjectascii - The StringBuilder onto which the ASCII representation is appended.level - The indentation level of the object.protected void toASCIIGnuStep(StringBuilder ascii, int level)
NSObjectascii - The StringBuilder onto which the ASCII representation is appended.level - The indentation level of the object.public int compareTo(NSObject o)
Copyright © 2024. All rights reserved.