public class NSString extends NSObject implements NSSecureCoding
Modifier and Type | Method and Description |
---|---|
static boolean |
canBeConvertedToEncoding(String self,
int NSStringEncoding)
Check whether a string can be converted to the specified encoding
|
static int |
compare(String self,
String with,
int NSStringCompareOptions)
Compares the given Strings using the specified options.
|
static List<String> |
componentsSeparatedByString(String self,
String separator)
Returns a list that contains the substrings of the specified String
divided by the given separator.
|
static NSData |
dataUsingEncoding(String string,
int NSStringEncoding)
Returns an NSData object that represents the given String encoded using
the specified NSStringEncoding.
|
static CGSize |
drawAtPoint(String self,
CGPoint point,
UIFont font)
Deprecated.
|
static String |
initWithData(NSData data,
int NSStringEncoding)
Returns a String that is encoded representation of the given
NSData object of the specified encoding.
|
static String |
initWithFormat(String format,
NSLocale loc,
Object... args)
Get a localized version of a formatted String
|
static String |
initWithFormat(String format,
Object... args)
Create a String based on the provided format
|
static String |
localizedStringWithFormat(String format,
Object... args)
Get a localized version of a formatted String using current locale
|
static CGSize |
sizeWithFont(String self,
UIFont font)
Deprecated.
|
static CGSize |
sizeWithFont(String self,
UIFont font,
CGSize size,
int NSLineBreakMode)
Deprecated.
|
static String |
stringByAddingPercentEscapesUsingEncoding(String self,
int NSStringEncoding)
Creates and returns a new NSString object by adding percent escapes in
order to convert it to a legal URL.
|
static String |
stringByReplacingCharactersInRange(String self,
NSRange range,
String replacement)
Return a new string, where the content inside range is replaced with replacement
|
static String |
stringByReplacingPercentEscapesUsingEncoding(String self,
int NSStringEncoding)
Creates and returns a new NSString object from the interpretation of the
specified URL replacing all percent escapes with the matching characters
using the specified encoding.
|
static String |
stringWithContentsOfFile(String path)
Deprecated.
|
static String |
stringWithContentsOfFile(String path,
int NSStringEncoding,
crossmobile.rt.StrongReference<NSError> error)
Returns a String that is the result of reading data from the specified
file.
|
static String |
stringWithContentsOfURL(NSURL url)
Deprecated.
|
static String |
stringWithContentsOfURL(NSURL url,
int NSStringEncoding,
crossmobile.rt.StrongReference<NSError> error)
Deprecated.
|
static boolean |
writeToFile(String self,
String path,
boolean atomically,
int NSStringEncoding,
crossmobile.rt.StrongReference<NSError> error)
Writes the specified content to the specified file using the given
encoding.
|
addObserver, observeValueForKeyPath, performSelector, performSelectorOnMainThread, release, removeObserver, removeObserver, retain, setValueForKey, setValueForUndefinedKey, valueForKey, valueForUndefinedKey
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
supportsSecureCoding
public static NSData dataUsingEncoding(String string, int NSStringEncoding)
string
- The initial String that is converted to a NSData object.NSStringEncoding
- The String encoding that is used.@Deprecated public static String stringWithContentsOfURL(NSURL url, int NSStringEncoding, crossmobile.rt.StrongReference<NSError> error)
url
- The URL from which to read data.NSStringEncoding
- The encoding that is used.error
- The error that occurs in case of failure.NULL when there the
error description is useless.@Deprecated public static String stringWithContentsOfURL(NSURL url)
url
- The URL that is interpreted.@Deprecated public static String stringWithContentsOfFile(String path)
path
- The path of the file.public static String stringWithContentsOfFile(String path, int NSStringEncoding, crossmobile.rt.StrongReference<NSError> error)
path
- The path of the file.NSStringEncoding
- the file encodingerror
- The error that occurs in case of failurepublic static boolean canBeConvertedToEncoding(String self, int NSStringEncoding)
self
- the String to check if it can be convertedNSStringEncoding
- the desired encodingNSStringEncoding
public static String stringByReplacingCharactersInRange(String self, NSRange range, String replacement)
self
- The string to act onrange
- The range which will be replacedreplacement
- The replacement stringpublic static String stringByReplacingPercentEscapesUsingEncoding(String self, int NSStringEncoding)
self
- The URL that is used.NSStringEncoding
- The encoding used for the returned string.public static String stringByAddingPercentEscapesUsingEncoding(String self, int NSStringEncoding)
self
- The URL that is used.NSStringEncoding
- The encoding used for the returned string.public static int compare(String self, String with, int NSStringCompareOptions)
self
- The first String to be compared.with
- The second String to be compared.NSStringCompareOptions
- The option for searching the Strings.NSOrdered
public static List<String> componentsSeparatedByString(String self, String separator)
self
- The initial String.separator
- The separator String.public static String initWithData(NSData data, int NSStringEncoding)
data
- The NSData object to be encoded.NSStringEncoding
- The encoding used.public static String initWithFormat(String format, Object... args)
format
- The iOS-type formattingargs
- The possible arguments, up to 20 argumentspublic static String localizedStringWithFormat(String format, Object... args)
format
- The iOS-type formattingargs
- The possible arguments, up to 20 argumentspublic static String initWithFormat(String format, NSLocale loc, Object... args)
format
- The iOS-type formattingargs
- The possible arguments, up to 20 argumentsloc
- The preferred locale@Deprecated public static CGSize drawAtPoint(String self, CGPoint point, UIFont font)
self
- The string that is drawn.point
- The benchmark of the text drawing.font
- The font that is used.@Deprecated public static CGSize sizeWithFont(String self, UIFont font)
self
- The String for which the size is requested.font
- The font that the String would have.@Deprecated public static CGSize sizeWithFont(String self, UIFont font, CGSize size, int NSLineBreakMode)
self
- The String for which the size is requested.font
- The font that the String would have.size
- The initial size of the String.NSLineBreakMode
- The line break options in order to compute the new
size.public static boolean writeToFile(String self, String path, boolean atomically, int NSStringEncoding, crossmobile.rt.StrongReference<NSError> error)
self
- The content that will be written to the file.path
- The path of the file to which the content will be written.atomically
- FALSE if the content was written directly, TRUE if
there was an auxiliary file.NSStringEncoding
- The string encoding.error
- The error that occurs in case of failure.NULL when there the
error description is useless.Copyright © 2020. All rights reserved.