Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

remove first 3 lines of a string

Posted on 2013-11-07
10
Medium Priority
?
231 Views
Last Modified: 2013-11-07
I have a textbox listed below and would like to know how to remove the first couple of line.  I would like my textbox to start with the line "insert_job"


 
 /ASYS /backup /bin /boot /CC /dev /etc /export /home /lib /lib64 /lost+found /media /misc /mnt /net /opt /oracle /proc /PSL_install.log /root /sbin /selinux /srv /sys /tmp /usr /var ----------------- chadster ----------------- */
 
 insert_job: chadster job_type: c
 command: sleep 2
 machine: server2
 owner: userid
 permission: gx
 description: "clone test job"
 std_out_file: /tmp/chadster.out
 std_err_file: /tmp/chadster.err
 alarm_if_fail: 0
0
Comment
Question by:chadmanvb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
10 Comments
 
LVL 22

Expert Comment

by:plusone3055
ID: 39630239
is it always that sequence character for character before
Insert Job ?
0
 
LVL 22

Expert Comment

by:plusone3055
ID: 39630245
also is the output of the textbox a string ?
0
 

Author Comment

by:chadmanvb
ID: 39630261
No, the text before "insert" does change everytime and I am useing a string for the textbox.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22

Expert Comment

by:plusone3055
ID: 39630325
okay then there are 2 steps to this

1. you need to do an indexof the string that is the textbox looking for
insert_job:

intposition = strtextbox.Indexof("insert_Job",0)

2. use RIGHt to display everything to the RIGHT of that inpostion from the string

dim strtexboxoutput as string = RIGHT(strtextbox,inposition)


that should do the trick
0
 

Author Comment

by:chadmanvb
ID: 39630507
What am I doing wrong?  It have -1 for my intposition and that does not seem correct.  Also I cant compile with inposition on the last line.

Here is what I have

 Dim intposition
        Dim strtextbox As String = TextBox1.Text

        intposition = strtextbox.IndexOf("insert_Job", 0)
        MsgBox(intposition)

        Dim strtexboxoutput As String = Strings.Right(strtextbox, inposition)
0
 
LVL 22

Accepted Solution

by:
plusone3055 earned 2000 total points
ID: 39630575
this works

       Dim str123 As String
        str123 = txt1.Text
        MessageBox.Show(str123)

        Dim intposition As Integer
        intposition = str123.IndexOf("insert", 0)
        MessageBox.Show(intposition)

        Dim stroutput As String = str123.Substring(intposition)

        MessageBox.Show(stroutput)
0
 

Author Closing Comment

by:chadmanvb
ID: 39630602
Pefect!  Thanks!
0
 
LVL 22

Expert Comment

by:plusone3055
ID: 39630614
no problem happy coding :)
0
 
LVL 40
ID: 39630619
Take the time to define the type of your variables. It prevents many types of bugs:

Dim intposition as Integer.

IndexOf is sensitive to case. According to your original question, you should look for insert_job with a lowercase 'j'.

The last line does not work because you forgot the 't' in the third character of intposition.
0
 
LVL 22

Expert Comment

by:plusone3055
ID: 39630633
JamesBurger is right
I didnt even see the syntax errors on that when you posted until he pointed them out. Slow and steady does win the race :)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question