473,322 Members | 1,352 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

increase string length

eyeofsoul
how do i increase a string into default lenght?
for example i put a string, java.how to transform the string to for example 24 character in it?
Mar 4 '08 #1
6 9366
JosAH
11,448 Expert 8TB
how do i increase a string into default lenght?
for example i put a string, java.how to transform the string to for example 24 character in it?
There is no such thing as a 'default string length', maybe zero, but that isn't
its default length. Read the API documentation for the String class and note
that Strings are immutable objects. Also have a look at the StringBuilder class.

kind regards,

Jos
Mar 4 '08 #2
what i mean is that if i insert a string, which is "java".can i increase the length the string into 24 char after some operation?
Mar 4 '08 #3
sukatoa
539 512MB
what i mean is that if i insert a string, which is "java".can i increase the length the string into 24 char after some operation?
Maybe you mean StringBuffer?!! StringBuffer can change its current allocated length and it is extendable...

After this implementation, you can convert it directly to String...

See this


Hopefully it helps,
Sukatoa
Mar 4 '08 #4
nope.string buffer need you to manually input the char that we want to.in my case i want "some" process which can help the string to be expand to 24 char by the process automatically.
Mar 4 '08 #5
BigDaddyLH
1,216 Expert 1GB
There's not a lot of automagic in programming! It's also still not clear what your context is, but gazing into my crystal ball, I see a need to format fixed width columns of output. Formatter is designed to support that:

http://java.sun.com/javase/6/docs/ap...Formatter.html

Format methods also pop up in java.io.PrintWriter and PrintStream (aka System.out).
Mar 4 '08 #6
sukatoa
539 512MB
nope.string buffer need you to manually input the char that we want to.in my case i want "some" process which can help the string to be expand to 24 char by the process automatically.
If i were to implement that,

If i have a string "anything" and in the process should add 24 char, i will convert my string into char array by not using toCharArray, i will allocate the char array in length of anything + 24, then copy the characters into char array...

Expand|Select|Wrap|Line Numbers
  1. charr[x] = string.charAt(x);
After that, convert the char array into String...

If this is too far again to your idea, then i can't help you as of now...

Sukatoa
Mar 4 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Mitchua | last post by:
Simplified a bit, I'm parsing HTML documents to get sentences e.g. my $html = get($URL); # remove all HTML TAGs...blah blah blah @sentences = split(/\./, $html)); then I'm trying to determine the...
18
by: Zygmunt Krynicki | last post by:
Hello I've browsed the FAQ but apparently it lacks any questions concenring wide character strings. I'd like to calculate the length of a multibyte string without converting the whole string. ...
8
by: Al Sav | last post by:
Hi, Which one of these below two is a better way to find out if the string is of zero length? string.Length == 0 or string.Length < 0 Alwin S.
3
by: Sam | last post by:
I want to divide character into 2 section. Example, 200412 divided into 2004 in A block and 12 in B block. Please advise how to use left(string, length) or right(string, length) for above...
1
by: MattB | last post by:
Hi. I've got a vb.net/asp.net application that passes strings back a forth between a c++ COM object. We use simple tagging to designate what's what, and it's worked pretty well until now. We had...
3
by: ipellew | last post by:
Hi; Whats the maximum string length in Javascript. Is it the same across all the browsers? max_s_len = str.length // what the max number of chars we can have is str? Regards
5
by: gezerpunta | last post by:
Hi strlen does not return the correct value .I compared the filesize() and strlen byte size but they are not equal. I must find binary string length and it must be equal to filesize() thks.
6
by: csmith8933 | last post by:
I'm trying to loop until the string length is 0, deleting one character at a time. This doesnt work for obvious reasons I'm sure. string s; s = "0000011111"; while (s.length() 0) {...
1
by: Deepthi Bittu | last post by:
I am migrating the data structure from MS SQL SERVER to ORACLE 11g database. The length of the table names,column names and key names are big in length in MS SQL SERVER. But, when i am migrating the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.