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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:28:32+00:00 2026-05-25T21:28:32+00:00

I am creating a custom field where I want to replace some unicode caracters

  • 0

I am creating a custom field where I want to replace some unicode caracters by pictures. Its like doing emoticons for blackberry device. Well I have a problem looping the caracters in the edit field and replacing the unicode caracters by images. When the text becomes too long, the loop takes too much time.

My code is as follows:

String aabb = "";
char[] chara = this.getText().toCharArray();
for (int i = loc; i < chara.length; i ++) {
   Character cc = new Character(chara[i]);
   aabb += cc.toString();
   if (unicodeCaracter) {
       //Get the location
       //draw the image in the appropriate X and Y
   }
}

Well this works fine, and the images are getting in the right place. But the problem is when the text becomes large, the looping is taking too much time, and the input of the text on the device becomes non friendly.

How to find the unicode caracters in a text without having to loop each time for them? Is their another way than this that I missed?

I need help with this issue. Thanks in advance

  • 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-05-25T21:28:33+00:00Added an answer on May 25, 2026 at 9:28 pm

    Well you’re creating a new Character and a new String in each iteration of the loop, and converting the string to a character array to start with. You’re also using string concatenation in a loop rather than using a StringBuffer. All of these will be hurting performance.

    It’s not obvious what you mean by “Unicode characters” here – all characters in Java are Unicode characters. I suspect you really want something like:

    String text = this.getText();
    StringBuffer buffer = new StringBuffer(text.length());
    for (int i = 0; i < text.length(); i++) {
        char c = text.charAt(i);
        buffer.append(c);
        if (c > 127) { // Or whatever
            // Take some action
        }
    }
    

    I’m assuming the “take some action” will be changing the buffer in some respect, otherwise the buffer is pointless of course… but fundamentally that’s likely to be the sort of change you want.

    The string concatenation in a loop is a particularly bad idea – see my article on it for more details.

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

Sidebar

Related Questions

I'm creating some custom work items in TFS and the helptext field seems handy
Im creating a custom field in MVC3 (C#) that I would like to access
I'm writing a custom field for Sitecore and I want a list box. Interestingly,
I want to create a custom field type (MyCompLookup) that will be used in
I am creating custom html helper for my datepicker. i want to pass inside
I am creating a custom MVC component in Joomla and want to use tooltip
I want to create a custom input view, some of whose buttons insert icons
I have mastered creating custom data types and adding fields with CCK. Then I
I have 2 custom fields in my WordPress system when creating new posts. One
I'm often creating custom assertion methods for my JUnit tests. eg: public void assertArrays(String[]

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.