后浪云鸿蒙OS教程:鸿蒙OS StringIndexOutOfBoundsException

树叶云

StringIndexOutOfBoundsException

java.lang.Object

|—java.lang.Throwable

|—|—java.lang.Exception

|—|—|—java.lang.RuntimeException

|—|—|—|—java.lang.IndexOutOfBoundsException

|—|—|—|—|—java.lang.StringIndexOutOfBoundsException

public class StringIndexOutOfBoundsException
extends IndexOutOfBoundsException

由 String 方法抛出以指示索引为负数或大于字符串的大小。 对于某些方法,例如 charAt 方法,当索引等于字符串的大小时也会引发此异常。

构造函数摘要

构造函数描述
StringIndexOutOfBoundsException()构造一个没有详细消息的 StringIndexOutOfBoundsException。
StringIndexOutOfBoundsException(int index)使用指示非法索引的参数构造一个新的 StringIndexOutOfBoundsException 类。
StringIndexOutOfBoundsException(String s)使用指定的详细消息构造 StringIndexOutOfBoundsException。

方法总结

从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
从类 java.lang.Throwable 继承的方法
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString

构造函数详细信息

StringIndexOutOfBoundsException

public StringIndexOutOfBoundsException()

构造一个没有详细消息的 StringIndexOutOfBoundsException。

StringIndexOutOfBoundsException

public StringIndexOutOfBoundsException(String s)

使用指定的详细消息构造 StringIndexOutOfBoundsException。

参数:

参数名称参数描述
s详细信息。

StringIndexOutOfBoundsException

public StringIndexOutOfBoundsException(int index)

使用指示非法索引的参数构造一个新的 StringIndexOutOfBoundsException 类。

参数:

参数名称参数描述
index非法索引。

文章来源网络,作者:运维,如若转载,请注明出处:https://shuyeidc.com/wp/196774.html<

(0)
运维的头像运维
上一篇2025-04-03 14:50
下一篇 2025-04-03 14:52

相关推荐

发表回复

您的邮箱地址不会被公开。必填项已用 * 标注