Home | Advertising Info6 USERS CURRENTLY ONLINE   
PowerASP
   Site Search Contact Us Monday, May 20, 2024  

  Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
Classic ASP - Advanced
 PowerASP Code Help Area : Classic ASP - Advanced
Subject Topic: Split string Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
BradSullivan
Newbie
Newbie
Avatar

Joined: April/20/2005
Online Status: Offline
Posts: 3
Posted: April/20/2005 at 12:33pm | IP Logged Quote BradSullivan

I am trying to split a string in two, at a set distance, but it needs to be between words.  I am able to do a left(string,250) no problem, but it could end up in the middle of a word.
Any easy ideas?
Back to Top View BradSullivan's Profile Search for other posts by BradSullivan
 
cwilliams
Admin Group
Admin Group
Avatar

Joined: April/26/2004
Location: United States
Online Status: Offline
Posts: 137
Posted: April/20/2005 at 4:02pm | IP Logged Quote cwilliams

please explain this better.. I for one am not quite sure what you mean.

how about some example of the strings you are trying to split for starters

 



__________________


Chris Williams
http://www.PowerASP.com
Back to Top View cwilliams's Profile Search for other posts by cwilliams
 
BradSullivan
Newbie
Newbie
Avatar

Joined: April/20/2005
Online Status: Offline
Posts: 3
Posted: April/21/2005 at 12:51pm | IP Logged Quote BradSullivan

Thanks for trying to help, but I figured it out.
I guess I shouldn't have said strings, what I was trying to do is take a whole sentence and split it into two seperate ones, but couldn't have it split in the middle of a word.  I ended up using InStrRev.
Thanks again


Edited by BradSullivan on April/21/2005 at 12:52pm
Back to Top View BradSullivan's Profile Search for other posts by BradSullivan
 
jlk3
Newbie
Newbie


Joined: May/12/2005
Location: United States
Online Status: Offline
Posts: 1
Posted: May/12/2005 at 11:41pm | IP Logged Quote jlk3

Can you post the code you used to split the string between words?

Thanks!

Back to Top View jlk3's Profile Search for other posts by jlk3
 
BradSullivan
Newbie
Newbie
Avatar

Joined: April/20/2005
Online Status: Offline
Posts: 3
Posted: May/13/2005 at 9:34am | IP Logged Quote BradSullivan

If you just want to split a single string like "Full Name" at the space in between, you can do this:

firstname = trim(left(fullname,instr(fullname," ")))
lastname = trim(right(fullname,len(agent)-len(fname)))


What I was trying to do was split a sentence in half, but make sure it wasn't in the middle of a word, which is done with:
left(MyInput,InStrRev( MyInput, " ",2000))
It's like doing a left(MyInput,2000) which returns the first 2000 characters, but the "InStrRev" makes sure its at a space.
You can get the remainder of the sentence using:
right(MyInput,len(MyInput) - InStrRev( MyInput, " ",2000))
Back to Top View BradSullivan's Profile Search for other posts by BradSullivan
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum

   Active Server Pages Rule The World
Contact Us  
All artwork, design & content contained in this site are Copyright © 1998 - 2024 PowerASP.com and Christopher J. Williams
Banner ads ,other site logos, etc are copyright of their respective companies.
STATS Unless otherwise noted - All Rights Reserved.

PowerASP active server pages asp.net microsoft .net framework sdk learn asp what is asp tutorial learn asp.net CJWSoft ASPProtect ASPBanner ASPClassifieds www.aspprotect.com, www.cjwsoft.com,www.aspclassifieds.com,www.aspphotogallery.com