The Artima Developer Community
Sponsored Link

Java Answers Forum
Working with strings

1 reply on 1 page. Most recent reply: Oct 30, 2002 4:37 AM by Samir Pipalia

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
jake

Posts: 83
Nickname: onorok
Registered: May, 2002

Working with strings Posted: Oct 29, 2002 1:00 PM
Reply to this message Reply
Advertisement
My function takes a String object as a parameter and I need to be able to delete or remove the last character in the String. How would I do this, assume my Function is
public String string_thing(String w)
{
return (String without the end)
}

anybody??


Samir Pipalia

Posts: 1
Nickname: samir
Registered: Oct, 2002

Re: Working with strings Posted: Oct 30, 2002 4:37 AM
Reply to this message Reply
Hi,

You need something like this:

public String string_thing(String w)
{
return w.substring(0, w.length() - 1);
}

If you need more information about strings refer to Sun's API pages: http://java.sun.com/j2se/1.4/docs/api/

Flat View: This topic has 1 reply on 1 page
Topic: Image as backgrouns in a FRAME (so NOT in an Applet or 'swing') Previous Topic   Next Topic Topic: how to send fax using pure  java api's

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use