# Transliterator.Position

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Position

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/icu/text/Transliterator.Position "View this page in Java")  

```
open class Position
```

|---|--------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                       ||
| ↳ | [android.icu.text.Transliterator.Position](https://developer.android.com/reference/kotlin/android/icu/text/Transliterator.Position#) |

Position structure for incremental transliteration. This data structure defines two substrings of the text being transliterated. The first region, \[contextStart, contextLimit), defines what characters the transliterator will read as context. The second region, \[start, limit), defines what characters will actually be transliterated. The second region should be a subset of the first.

After a transliteration operation, some of the indices in this structure will be modified. See the field descriptions for details.

contextStart \<= start \<= limit \<= contextLimit

Note: All index values in this structure must be at code point boundaries. That is, none of them may occur between two code units of a surrogate pair. If any index does split a surrogate pair, results are unspecified.

## Summary

|                                                                                                                                                                                                                                                                                                             Public constructors                                                                                                                                                                                                                                                                                                             ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [Position](https://developer.android.com/reference/kotlin/android/icu/text/Transliterator.Position#Position())`()` Constructs a Position object with start, limit, contextStart, and contextLimit all equal to zero.                                                                                                                                                                                                                                                                                                                                                                                                                     |
| [Position](https://developer.android.com/reference/kotlin/android/icu/text/Transliterator.Position#Position(android.icu.text.Transliterator.Position))`(`pos:` `[Transliterator.Position](https://developer.android.com/reference/kotlin/android/icu/text/Transliterator.Position#)!`)` Constructs a Position object that is a copy of another.                                                                                                                                                                                                                                                                                          |
| [Position](https://developer.android.com/reference/kotlin/android/icu/text/Transliterator.Position#Position(kotlin.Int,%20kotlin.Int,%20kotlin.Int))`(`contextStart:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `contextLimit:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `start:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Constructs a Position object with the given start, contextStart, and contextLimit.                                                                                                             |
| [Position](https://developer.android.com/reference/kotlin/android/icu/text/Transliterator.Position#Position(kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int))`(`contextStart:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `contextLimit:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `start:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `limit:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Constructs a Position object with the given start, limit, contextStart, and contextLimit. |

|                                                                                                                                                                                                     Public methods                                                                                                                                                                                                      ||
|----------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [equals](https://developer.android.com/reference/kotlin/android/icu/text/Transliterator.Position#equals(kotlin.Any))`(`other:` `[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?`)` Returns true if this Position is equal to the given object.                                                      |
| open[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)         | [hashCode](https://developer.android.com/reference/kotlin/android/icu/text/Transliterator.Position#hashCode())`()` Returns a hash code value for the object.                                                                                                                                                                    |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)       | [set](https://developer.android.com/reference/kotlin/android/icu/text/Transliterator.Position#set(android.icu.text.Transliterator.Position))`(`pos:` `[Transliterator.Position](https://developer.android.com/reference/kotlin/android/icu/text/Transliterator.Position#)!`)` Copies the indices of this position from another. |
| open[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)   | [toString](https://developer.android.com/reference/kotlin/android/icu/text/Transliterator.Position#toString())`()` Returns a string representation of this Position.                                                                                                                                                            |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [validate](https://developer.android.com/reference/kotlin/android/icu/text/Transliterator.Position#validate(kotlin.Int))`(`length:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Check all bounds.                                                                                            |

|                                                                                                                                                Properties                                                                                                                                                ||
|----------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [contextLimit](https://developer.android.com/reference/kotlin/android/icu/text/Transliterator.Position#contextLimit:kotlin.Int) Ending index, exclusive, of the context to be considered for a transliteration operation.    |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [contextStart](https://developer.android.com/reference/kotlin/android/icu/text/Transliterator.Position#contextStart:kotlin.Int) Beginning index, inclusive, of the context to be considered for a transliteration operation. |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [limit](https://developer.android.com/reference/kotlin/android/icu/text/Transliterator.Position#limit:kotlin.Int) Ending index, exclusive, of the text to be transliteratd.                                                  |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [start](https://developer.android.com/reference/kotlin/android/icu/text/Transliterator.Position#start:kotlin.Int) Beginning index, inclusive, of the text to be transliteratd.                                               |

## Public constructors

### Position

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Position()
```

Constructs a Position object with start, limit, contextStart, and contextLimit all equal to zero.  

### Position

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Position(pos: Transliterator.Position!)
```

Constructs a Position object that is a copy of another.  

### Position

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Position(
    contextStart: Int, 
    contextLimit: Int, 
    start: Int)
```

Constructs a Position object with the given start, contextStart, and contextLimit. The limit is set to the contextLimit.  

### Position

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Position(
    contextStart: Int, 
    contextLimit: Int, 
    start: Int, 
    limit: Int)
```

Constructs a Position object with the given start, limit, contextStart, and contextLimit.

## Public methods

### equals

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun equals(other: Any?): Boolean
```

Returns true if this Position is equal to the given object.

|                     Parameters                     ||
|-------|---------------------------------------------|
| `obj` | the reference object with which to compare. |

|                                                                           Return                                                                           ||
|------------------------------------------------------------------------------------|------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `true`if this object is the same as the obj argument;`false`otherwise. |

### hashCode

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun hashCode(): Int
```

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by[java.util.HashMap](https://developer.android.com/reference/kotlin/java/util/HashMap.html#).

The general contract of`hashCode`is:

- Whenever it is invoked on the same object more than once during an execution of a Java application, the`hashCode`method must consistently return the same integer, provided no information used in`equals`comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
- If two objects are equal according to the[equals](https://developer.android.com/reference/kotlin/java/lang/Object.html#equals(kotlin.Any))method, then calling the`hashCode`method on each of the two objects must produce the same integer result.
- It is*not* required that if two objects are unequal according to the[equals](https://developer.android.com/reference/kotlin/java/lang/Object.html#equals(kotlin.Any))method, then calling the`hashCode`method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

|                                                     Return                                                     ||
|----------------------------------------------------------------------------|------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | a hash code value for this object. |

### set

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun set(pos: Transliterator.Position!): Unit
```

Copies the indices of this position from another.  

### toString

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun toString(): String
```

Returns a string representation of this Position.

|                                                          Return                                                          ||
|----------------------------------------------------------------------------------|----------------------------------------|
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | a string representation of the object. |

### validate

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun validate(length: Int): Unit
```

Check all bounds. If they are invalid, throw an exception.

|                                                              Parameters                                                              ||
|----------|----------------------------------------------------------------------------------------------------------------------------|
| `length` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the length of the string this object applies to |

|                               Exceptions                               ||
|--------------------------------------|----------------------------------|
| `java.lang.IllegalArgumentException` | if any indices are out of bounds |

## Properties

### contextLimit

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
var contextLimit: Int
```

Ending index, exclusive, of the context to be considered for a transliteration operation. The transliterator will ignore anything at or after this index. INPUT/OUTPUT parameter: This parameter is updated to reflect changes in the length of the text, but points to the same logical position in the text.  

### contextStart

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
var contextStart: Int
```

Beginning index, inclusive, of the context to be considered for a transliteration operation. The transliterator will ignore anything before this index. INPUT/OUTPUT parameter: This parameter is updated by a transliteration operation to reflect the maximum amount of antecontext needed by a transliterator.  

### limit

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
var limit: Int
```

Ending index, exclusive, of the text to be transliteratd. INPUT/OUTPUT parameter: This parameter is updated to reflect changes in the length of the text, but points to the same logical position in the text.  

### start

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
var start: Int
```

Beginning index, inclusive, of the text to be transliteratd. INPUT/OUTPUT parameter: This parameter is advanced past characters that have already been transliterated by a transliteration operation.