0

I have a string like below and am trying to remove the last character from that string. can someone please help on this

what if I have a lengthy string and I want to only remove the last character of my string.

Example: "city": "Winston Salem","state": "NC","zip": "27127","country": " "}}

and I want to only remove the last '}'.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
  • Does this answer your question? [How to remove the last character from a string?](https://stackoverflow.com/questions/7438612/how-to-remove-the-last-character-from-a-string) – Ori Marko Jun 14 '22 at 08:11

1 Answers1

0

Use a String method like replace:

String newString = oldString.replace("}}", "}")

if that´s case or another one; you can use anywhere of methods of String API only if casts to String

CharlyDan
  • 1
  • 1