Compartilhar via


TextUtils Class

Definition

[Android.Runtime.Register("android/text/TextUtils", DoNotGenerateAcw=true)]
public class TextUtils : Java.Lang.Object
[<Android.Runtime.Register("android/text/TextUtils", DoNotGenerateAcw=true)>]
type TextUtils = class
    inherit Object
Inheritance
TextUtils
Attributes

Remarks

Android platform documentation

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

TextUtils(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Fields

SafeStringFlagFirstLine
Obsolete.

Return only first line of text (truncate at first newline).

SafeStringFlagSingleLine
Obsolete.

Force entire string into single line of text (no newlines).

SafeStringFlagTrim
Obsolete.

Remove Character#isWhitespace(int) whitespace and non-breaking spaces from the edges of the label.

Properties

CharSequenceCreator
Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
CommaEllipsize(String, TextPaint, Single, String, String)

Converts a CharSequence of the comma-separated form "Andy, Bob, Charles, David" that is too wide to fit into the specified width into one like "Andy, Bob, 2 more".

CommaEllipsizeFormatted(ICharSequence, TextPaint, Single, String, String)

Converts a CharSequence of the comma-separated form "Andy, Bob, Charles, David" that is too wide to fit into the specified width into one like "Andy, Bob, 2 more".

Concat(String[])

Returns a CharSequence concatenating the specified CharSequences, retaining their spans if any.

ConcatFormatted(ICharSequence[])

Returns a CharSequence concatenating the specified CharSequences, retaining their spans if any.

CopySpansFrom(ISpanned, Int32, Int32, Class, ISpannable, Int32)

Copies the spans from the region start...end in source to the region destoff...destoff+end-start in dest.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
DumpSpans(ICharSequence, IPrinter, String)

Debugging tool to print the spans in a CharSequence.

DumpSpans(String, IPrinter, String)

Debugging tool to print the spans in a CharSequence.

Ellipsize(String, TextPaint, Single, TextUtils+TruncateAt, Boolean, TextUtils+IEllipsizeCallback)

Returns the original text if it fits in the specified width given the properties of the specified Paint, or, if it does not fit, a truncated copy with ellipsis character added at the specified edge or center.

Ellipsize(String, TextPaint, Single, TextUtils+TruncateAt)

Returns the original text if it fits in the specified width given the properties of the specified Paint, or, if it does not fit, a truncated copy with ellipsis character added at the specified edge or center.

EllipsizeFormatted(ICharSequence, TextPaint, Single, TextUtils+TruncateAt, Boolean, TextUtils+IEllipsizeCallback)

Returns the original text if it fits in the specified width given the properties of the specified Paint, or, if it does not fit, a truncated copy with ellipsis character added at the specified edge or center.

EllipsizeFormatted(ICharSequence, TextPaint, Single, TextUtils+TruncateAt)

Returns the original text if it fits in the specified width given the properties of the specified Paint, or, if it does not fit, a truncated copy with ellipsis character added at the specified edge or center.

Equals(ICharSequence, ICharSequence)

Returns true if a and b are equal, including if they are both null.

Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
Equals(String, String)

Returns true if a and b are equal, including if they are both null.

ExpandTemplate(String, String[])

Replace instances of "^1", "^2", etc.

ExpandTemplateFormatted(ICharSequence, ICharSequence[])

Replace instances of "^1", "^2", etc.

GetCapsMode(ICharSequence, Int32, CapitalizationMode)

Determine what caps mode should be in effect at the current offset in the text.

GetCapsMode(String, Int32, CapitalizationMode)

Determine what caps mode should be in effect at the current offset in the text.

GetChars(ICharSequence, Int32, Int32, Char[], Int32)
GetChars(String, Int32, Int32, Char[], Int32)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetLayoutDirectionFromLocale(Locale)

Return the layout direction for a given Locale

GetOffsetAfter(ICharSequence, Int32)
GetOffsetAfter(String, Int32)
GetOffsetBefore(ICharSequence, Int32)
GetOffsetBefore(String, Int32)
GetReverse(String, Int32, Int32)

This function only reverses individual chars and not their associated spans.

GetReverseFormatted(ICharSequence, Int32, Int32)

This function only reverses individual chars and not their associated spans.

GetTrimmedLength(ICharSequence)

Returns the length that the specified CharSequence would have if spaces and ASCII control characters were trimmed from the start and end, as by String#trim.

GetTrimmedLength(String)

Returns the length that the specified CharSequence would have if spaces and ASCII control characters were trimmed from the start and end, as by String#trim.

HtmlEncode(String)

Html-encode the string.

IndexOf(ICharSequence, Char, Int32, Int32)
IndexOf(ICharSequence, Char, Int32)
IndexOf(ICharSequence, Char)
IndexOf(ICharSequence, ICharSequence, Int32, Int32)
IndexOf(ICharSequence, ICharSequence, Int32)
IndexOf(ICharSequence, ICharSequence)
IndexOf(String, Char, Int32, Int32)
IndexOf(String, Char, Int32)
IndexOf(String, Char)
IndexOf(String, String, Int32, Int32)
IndexOf(String, String, Int32)
IndexOf(String, String)
IsDigitsOnly(ICharSequence)

Returns whether the given CharSequence contains only digits.

IsDigitsOnly(String)

Returns whether the given CharSequence contains only digits.

IsEmpty(ICharSequence)

Returns true if the string is null or 0-length.

IsEmpty(String)

Returns true if the string is null or 0-length.

IsGraphic(Char)

Returns whether this character is a printable character.

IsGraphic(ICharSequence)

Returns whether the given CharSequence contains any printable characters.

IsGraphic(String)

Returns whether the given CharSequence contains any printable characters.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Join(ICharSequence, IIterable)

Returns a string containing the tokens joined by delimiters.

Join(ICharSequence, Object[])

Returns a string containing the tokens joined by delimiters.

Join(String, IIterable)

Returns a string containing the tokens joined by delimiters.

Join(String, Object[])

Returns a string containing the tokens joined by delimiters.

LastIndexOf(ICharSequence, Char, Int32, Int32)
LastIndexOf(ICharSequence, Char, Int32)
LastIndexOf(ICharSequence, Char)
LastIndexOf(String, Char, Int32, Int32)
LastIndexOf(String, Char, Int32)
LastIndexOf(String, Char)
MakeSafeForPresentation(String, Int32, Single, SafeStringFlagMode)

Remove html, remove bad characters, and truncate string.

MakeSafeForPresentationFormatted(String, Int32, Single, SafeStringFlagMode)

Remove html, remove bad characters, and truncate string.

Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
RegionMatches(ICharSequence, Int32, ICharSequence, Int32, Int32)
RegionMatches(String, Int32, String, Int32, Int32)
Replace(String, String[], String[])

Return a new CharSequence in which each of the source strings is replaced by the corresponding element of the destinations.

ReplaceFormatted(ICharSequence, String[], ICharSequence[])

Return a new CharSequence in which each of the source strings is replaced by the corresponding element of the destinations.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
Split(String, Pattern)

Splits a string on a pattern.

Split(String, String)

This method yields the same result as text.split(expression, -1) except that if text.isEmpty() then this method returns an empty array whereas "".split(expression, -1) would have returned an array with a single "".

StringOrSpannedString(String)
StringOrSpannedStringFormatted(ICharSequence)
Substring(ICharSequence, Int32, Int32)

Create a new String object containing the given range of characters from the source string.

Substring(String, Int32, Int32)

Create a new String object containing the given range of characters from the source string.

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
WriteToParcel(ICharSequence, Parcel, ParcelableWriteFlags)

Flatten a CharSequence and whatever styles can be copied across processes into the parcel.

WriteToParcel(String, Parcel, ParcelableWriteFlags)

Flatten a CharSequence and whatever styles can be copied across processes into the parcel.

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to