From 04c375e54ef6624cbe1939591846ecce2bf5833a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=CD=ACe=CD=A5b=CD=ADa=CD=ADs=CD=A4t=CD=ACian?= Date: Tue, 10 Sep 2024 22:21:46 +0200 Subject: [PATCH] rename deleteAt to deleteAtChar --- Sources/JavApi/lang/StringBuilder.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Sources/JavApi/lang/StringBuilder.swift b/Sources/JavApi/lang/StringBuilder.swift index e164842a..adad6d3e 100644 --- a/Sources/JavApi/lang/StringBuilder.swift +++ b/Sources/JavApi/lang/StringBuilder.swift @@ -38,7 +38,14 @@ public class StringBuilder { return self } - public func deleteAt (_ offset : Int) throws -> StringBuilder { + public func charAt (_ offset : Int) throws -> Character { + guard offset > -1, offset < self.count else { + throw java.lang.Throwable.IndexOutOufBoundsException(offset, "the index is negative or greater than or equal to count of String") + } + return Array (self.content)[offset] + } + + public func deleteCharAt (_ offset : Int) throws -> StringBuilder { guard offset > -1, offset < self.count else { throw java.lang.Throwable.IndexOutOufBoundsException(offset, "the index is negative or greater than or equal to count of String") }