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 8854835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:58:32+00:00 2026-06-14T13:58:32+00:00

I’m having problems with strings and I need a solution I’m trying to replace

  • 0

I’m having problems with strings and I need a solution I’m trying to replace characters found at a certain position with a character found in also the same position for example

 private String wordNormalize(String enteredWord,String dictionary){
    String normalizedWord = null;
// remove empty spaces at beginning and at the end of the word and change to lower case
    normalizedWord = enteredWord.trim().toLowerCase();

    //normalize term, removing all punctuation marks

    normalizedWord = normalizedWord.replaceAll("["+punctuationMarks2+"]", "[b,v]");

    //normalize word removing to character if dictionary has english lang                                           
    normalizedWord = normalizedWord.replaceFirst("to ", " ");
    //normalizeWord if dictionary has german
    if(normalizedWord.length() > 0){
        normalizedWord.replace("a,b,c","t,u,v");
    /*for(int i = 0;i<normalizedWord.length();i++){
          char currentChar = normalizedWord.charAt(i); // currently typed character
          String s1= Character.toString(currentChar);
        for(int j = 0;j<specialCharacters.length;j++){
        s1.replaceAll("[ "+specialCharacters[i]+" ]",""+replaceCharactersDe[i]+"");
        }
         = str.replace("a,b,c","t,u,v");
    }*/
    }

    //normalize term removing special characters and replacing them 
    /*for(int i = 0; i > specialCharacters.length;i++){
        if(normalizedWord.equals(specialCharacters[i])){
            normalizedWord = replaceCharactersDe[i];
        }
    }*/
    return normalizedWord;
}

So if a user enters a its replaced with t and if a user enters b its replaced with u and if the user enters c it will be replaced with v and only in that order is this possible and if it is show me the right way its supposed to be done

  • 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-14T13:58:33+00:00Added an answer on June 14, 2026 at 1:58 pm

    It is not clear to me what you are trying to approach with

    normalizedWord = normalizedWord.replaceAll("["+punctuationMarks2+"]", "[b,v]");
    

    It does not seem right, but i don’t know how to fix it because I don’t know what it’s trying to do. I guess what you are looking for is

    normalizedWord = normalizedWord.replaceAll("\\p{Punct}", "");
    

    On the other part you are doing nothing, because Strings are immutable. You want to do something like

    normalizedWord = normalizedWord.replace("a,b,c","t,u,v");

    but that would replace all occurrences of the substring "a,b,c" with the string "t,u,v"–

    What you want is:

    normalizedWord = normalizedWord.replace('a', 't');
    normalizedWord = normalizedWord.replace('b', 'u');
    normalizedWord = normalizedWord.replace('c', 'v');
    

    We could work on a more general solution, but you have to show us how the dictionary , which is a String, is formatted.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I need a function that will clean a strings' special characters. I do NOT
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I want to count how many characters a certain string has in PHP, but
I need to clean up various Word 'smart' characters in user input, including but
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace

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.