Page 1 of 1 1
Topic Options
#8259 - 2001-04-24 07:31 PM String Manipulation
Anonymous
Unregistered


Probably really easy, but I need to take the last three digits of a string and assign them to another variable. Help!
Top
#8260 - 2001-04-24 07:44 PM Re: String Manipulation
Anonymous
Unregistered


Try using something to this effect.
open (8, "c:\file.txt")
$x = readline(8)
$y = instr ($x, "Created:") ; searches for the start of the string
$result = substr ($x, $y+14,2); tells kix to asign the result to $result


Top
#8261 - 2001-04-24 07:51 PM Re: String Manipulation
Anonymous
Unregistered


Thanks, now for the more difficult (but probably still easy!) part...

I want to look for membership in one of 4 groups, each user will only be a member of one of these groups, once I have established which group they are a member of I wish to assign a variable based on the last 3 digits of that groupname. I could do this already using select,case,endselect or if statements but want a neat way.

The groups are called HCAMPUS_***, can I use wildcards in the ingroup() function? and if so how do I tell which group it found?

Nathan


Top
#8262 - 2001-04-24 08:58 PM Re: String Manipulation
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Welcome Nathan,

first the last 3 chars:

code:

$in = "1234567"
$out = substr($in,len($in)-3,3)
;$out should be now "567"

for that ingroup wildcard question : http://kixtart.org/board/Forum1/HTML/002163.html

Jochen

_________________________



Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 400 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.053 seconds in which 0.027 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org