Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8630495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:04:35+00:00 2026-06-12T09:04:35+00:00

First look at the code below public static void main(String args[]) { System.out.println(new Stringtest().test(The

  • 0

First look at the code below

public static void main(String args[])
   {
     System.out.println(new Stringtest().test("The system has saved your payment under        transaction number \369825655."));
    }

private String test(String aa)
    {
        return aa.substring(58);
    }

so logically this method should print 369825665. But it is printing 9825655 because of that backslash. Now I want the whole number. What should I do. I can not change the \ to \\ because the text is coming from a website.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:04:36+00:00Added an answer on June 12, 2026 at 9:04 am

    \ is an escape character. You need to escape the escape character.

    System.out.println(new Stringtest().test("The system has saved your payment under transaction number \\369825655."));
    

    For more on escape sequences, see this Oracle document. Essentially the backslash tells the system that the character(s) after it should be interpreted in a special manner (not simply as plain text). When you escape the escape, it gets treated specially as well… as plain text, instead of as an escape character.

    It can get confusing sometimes but is intuitive once you learn the core concepts.

    EDIT: If you can’t control the format the String comes to you in, you might be out of luck. I’ve been debugging this in Eclipse, and it seems like as soon as you create your String with that, the escape character gets processed and you lose the first two digits of your transaction number. You may need to get your database guys (or whomever formatted this terrible String) to change their implementation for you to do what you need to do. The Eclipse debugger suggests this, at least.

    It just so happens that, apparently, \36 processes fine and gets interpreted as another ASCII character that doesn’t show up. But in other cases, this will likely throw an Exception as an invalid escape sequence.

    In my own testing, it seems that as soon as the String literal is declared/created, the loss of information occurs. So there will be no way to recover it after that to my knowledge.

    Debug Screenshot
    debug info

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First look at this code: class Program { static void Main(string[] args) { var
Please have a look at the code below (excerpt from a C# book): public
First take a look at my code: <ListBox ItemsSource={Binding} SelectionMode=Multiple ItemTemplate={StaticResource ContactTemplate}> <ListBox.ContextMenu> <ContextMenu>
How to make the first matrix look like the latter? The code of the
At first look at the below aspx: <%@ Page Language=C# AutoEventWireup=true CodeBehind=WebForm4.aspx.cs Inherits=Amlak.WebForm4 %>
Basically my code look slike below: [assembly: WebActivator.PreApplicationStartMethod(typeof(OpusOneCorp.Presentation.Client.Mvc.EndUser.App_Start.StructuremapMvc), Start)] namespace OpusOneCorp.Presentation.Client.Mvc.EndUser.App_Start { public static
First look at this url: https://stackoverflow.com/questions/tagged/xoxoxo/ This directory does not exists but somehow stackoverflow
Ok let's first look at a screen shot. This is a screen shot of
have a problem. At first look at this HTML <div id=map style=background-image: url(map.png); width:
I am trying to implement a really simple example to get a first look

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.