problem on strings

problem on strings

in string1 "123456 ABC DEF...",IN string2 "raveen". iwant to add string2 after 123456 in the first string based on index number.i need logic for this with out using StringBuffer concept. Thanks in advanace

View Answers

September 21, 2011 at 1:15 PM

import java.awt.*;
import javax.swing.*;

class Header{
    public static void main(String []args){
      String st1="123456 ABC DEF";
      int index=st1.indexOf(' ');
      String substring1=st1.substring(0,index+1);
      String substring2=st1.substring(index+1);
      String st2="raveen"+" ";
      String st3=substring1.concat(st2).concat(substring2);
      JFrame f=new JFrame(st3);
      f.setLayout(null);
      JLabel l=new JLabel(st3);
      l.setBounds(50,10,300,20);
      f.add(l);
      f.setSize(300,100);
      f.setVisible(true);
    }
}









Related Tutorials/Questions & Answers:
problem on strings
problem on strings  in string1 "123456 ABC DEF...",IN string2 "raveen". iwant to add string2 after 123456 in the first string based on index number.i need logic for this with out using StringBuffer concept. Thanks in advanace
Java Strings problem - Java Interview Questions
Java Strings problem  How can you find a word which is repeating in maximum number of times in document, which is in text format in java?  Hi friend, To count the word repeating. import java.io.*; import
Advertisements
strings
strings  difference between the strings in java and c
strings
strings  write a program in java to accept two strings as command line arguments and perform the following operations-: 1) compare the strings 2... is an example which accept two strings as command line arguments and perform
strings
strings   read sentence and convert all the word into capital case like camelcase   Hi Friend, Try the following code: import java.util.*; class ConvertWordsIntoUpperCase { public static String toCamelCase(String
Strings
will contain strings which is separated by ",". From the main method invoke
Strings in PHP
Strings in PHP  Hi, I am beginners and want to know about strings in PHP and different ways to print a string. Can someone help me in this regards?   Following tutorials will help you in details about strings in PHP
strings concatnation
strings concatnation  in string1 "123456 ABC DEF...",IN string2 "raveen". iwant to add string2 after 123456 in the first string based on index number.i need logic
strings in java
strings in java  please explain me the flow of this program..not able to execute correctly n wats the use of clone public class Strclone { public static void main(String args[]) { String s=new String("a"); String s1
strings 20june
strings 20june  please explain me the flow of this program..not able to execute correctly n wats the use of clone public class Strclone { public static void main(String args[]) { String s=new String("a"); String s1 = "Hello
java program(strings) - Java Beginners
java program(strings)  Write a program in Java which accepts 2 strings as command line arguments. The program should do the following: i) print... in both the strings ii) replace every occurrence of ?a? or ?A? by @ iii) convert
strings
strings
strings
strings
strings
strings
strings
strings
Strings
programes on strings
programes on strings   a. write a program to copy one array to another array using System.arrayCopy() method. b. write a program to check whether entered string is palindrome or not.   Have a look at the following link
Switch Statement with Strings in Java
Switch Statement with Strings in Java  Switch Statement with Strings in Java
split strings in php
split strings in php  how can i split strings in word pair in PHP
ModuleNotFoundError: No module named 'strings'
ModuleNotFoundError: No module named 'strings'  Hi, My Python... 'strings' How to remove the ModuleNotFoundError: No module named 'strings... to install padas library. You can install strings python with following command
compare two strings in java
compare two strings in java  How to compare two strings in java...) { System.out.println("The two strings are the same."); } } } Output: The two strings are the same. Description:-Here is an example of comparing two
hash function for java strings
hash function for java strings  hash function for java strings   int hash=7; for (int i=0; i < strlen; i++) { hash = hash*31+charAt(i
convert numbers to strings using JavaScript
convert numbers to strings using JavaScript  How to convert numbers to strings using JavaScript
To check the Rotational Strings are Equall or not
To check the Rotational Strings are Equall or not  I attended 3dplm software company interview....there asked one question related to Strings.The question is................. Write a program to check the given two strings
Iphone Comparing Strings
Iphone Comparing Strings  Hi, I am very new in the mobile application programming. I have trying to develop a small application for IPhone SDK Comparing Strings. Could any one suggest or provide any examples topics iphone sdk
Grouping strings - Java Beginners
Grouping strings  I have written a code to determine the lengths of strings. What I need to do is to group strings that are within a certain range, say 15 to 20, 21 to 30, etc. Is there any one out there with an idea?  
Strings - Java Beginners
Strings  Normally when we assign one object to the other, a copy of the reference is created and both these references point to the same object. eg: Obj o1=new Obj(); Obj o2=o1; But is case of Strings, how
ModuleNotFoundError: No module named 'markdown-strings'
ModuleNotFoundError: No module named 'markdown-strings'  Hi, My... named 'markdown-strings' How to remove the ModuleNotFoundError: No module named 'markdown-strings' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'mutable-strings'
ModuleNotFoundError: No module named 'mutable-strings'  Hi, My... named 'mutable-strings' How to remove the ModuleNotFoundError: No module named 'mutable-strings' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'mutable-strings'
ModuleNotFoundError: No module named 'mutable-strings'  Hi, My... named 'mutable-strings' How to remove the ModuleNotFoundError: No module named 'mutable-strings' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'print_strings'
ModuleNotFoundError: No module named 'print_strings'  Hi, My... 'print_strings' How to remove the ModuleNotFoundError: No module named 'print_strings' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'strings-pkg'
ModuleNotFoundError: No module named 'strings-pkg'  Hi, My Python... 'strings-pkg' How to remove the ModuleNotFoundError: No module named 'strings-pkg' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'ioc-strings'
ModuleNotFoundError: No module named 'ioc-strings'  Hi, My Python... 'ioc-strings' How to remove the ModuleNotFoundError: No module named 'ioc-strings' error? Thanks   Hi, In your python environment
strings - Development process
, Code to solve the problem : import java.io.*; class DoubleToInt
searching for strings in a file
searching for strings in a file  how can i search of a person and display the other details associated with the name using java gui window?   import java.util.ArrayList; import javax.swing.*; import java.awt.event.
Appending Strings - Java Tutorials
.style1 { text-align: center; } Appending Strings In java, the two main ways for appending string at the end are : First method is using += operator. Second method is using append()  method. In this section, we
use strings as array indexes using JavaScript
use strings as array indexes using JavaScript  How to use strings as array indexes using JavaScript
How do I compare strings in Java?
How do I compare strings in Java?  How do I compare strings in Java
problem in onlinetest...
problem in onlinetest...  hi, my code getting the problem is ,when user leave a question then the server puts error... pls help me
To get the String between two strings
To get the String between two strings  How to get string between two strings repeatedly using java?   Hi, Please tell me more about what do you want to achive.ADS_TO_REPLACE_1 Thanks
validation of strings using java function
validation of strings using java function  hi all, i am uploading data from csv file to data base where i took student id as string of length 6 char of the form abc123 will you please give me a function to validate this field
Java create new array of strings.
Java create new array of strings.  Java create new array of strings.   Example: public class StringArray { public static void main(String[] args) { String name[] = { "mandy", "Rixi", "Ron
problem in validation
problem in validation  sir/madam, i m using struts-1.3.10. i m getting a problem my properties file is not found.... while i hav configuired it in struts-config.xml file, likeADS_TO_REPLACE_1 thanks n regards himanshu
javascript problem
javascript problem  hi guys My problem is that I am using radio button for yes or no but i want to do that if I press yes button then enter... enter please help me this problem
strings in java(18 june ,2011)
strings in java(18 june ,2011)  please explain me the flow of this program..not able to execute correctly n wats the use of clone public class Strclone { public static void main(String args[]) { String s=new String
strings in java(18 june ,2011)
strings in java(18 june ,2011)  please explain me the flow of this program..not able to execute correctly n wats the use of clone public class Strclone { public static void main(String args[]) { String s=new String

Ads