  | 
	
	
	
		Lench Beginner
 
  Joined: 26 Jan 2004 Posts: 21 Location: Norway
  | 
		
		  
			
			   Posted: Mon Feb 07, 2005 12:10 pm   
  Capitalisation and upper case   | 
			 
			
				#show $upper(z)uggsoft
 
 
returns Zuggsoft.
 
 
Now i have an alias that does this
 
 
setrescue
 
res1=%1
 
res2=%2
 
 
what i want it to do is to %upper the first letter in each variable.
 
 
But i just cant find out how :p | 
			 
		  | 
	
	
	  
		  
		    
			  _________________   | 
			       | 
			 
		   
		 | 
	
	
		  | 
	
	
		TonyWhispers Newbie
 
  Joined: 30 Jan 2005 Posts: 8
 
  | 
		
		  
			
			   Posted: Mon Feb 07, 2005 1:40 pm   Capitalize the first character of a string.   | 
			 
			
				#SHOW [BEGIN TEST-------------------
 
#VAR tmpvar_man2rescue testchar
 
#SHOW 1) The initial string: @tmpvar_man2rescue
 
 
#VAR tmpvar_firstchar %upper(%left(@tmpvar_man2rescue,1))
 
#SHOW 2) The first character capitalized: @tmpvar_firstchar
 
 
#VAR tmpvar_restofstring %copy(@tmpvar_man2rescue,2,%len(@tmpvar_man2rescue)-1)
 
#SHOW 3) The initial string with the first character removed: @tmpvar_restofstring
 
 
#VAR  tmpvar_capname %concat(@tmpvar_firstchar,@tmpvar_restofstring)
 
#SHOW 4) The intended, temporary string: @tmpvar_capname
 
#SHOW ---------------------END TEST]
 
 
 
	  | Code: | 
	 
	
	  #VAR tmpvar_man2rescue testchar
 
#VAR tmpvar_firstchar %upper (%left(@tmpvar_man2rescue,1) )
 
#VAR tmpvar_restofstring %copy(@tmpvar_man2rescue,2)
 
#VAR tmpvar_capname %concat(@tmpvar_firstchar,@tmpvar_restofstring)
 
 | 
	 
 
 | 
			 
		  | 
	
	
	  
		  
		    
			  _________________ zMUD Manual Source
 
Preventing Dead Posts: If the Tech Support solved your problem, please state as such. Thanks.
  Last edited by TonyWhispers on Mon Feb 07, 2005 2:45 pm; edited 3 times in total | 
			       | 
			 
		   
		 | 
	
	
		  | 
	
	
		Guinn Wizard
 
  Joined: 03 Mar 2001 Posts: 1127 Location: London
  | 
		
		  
			
			   Posted: Mon Feb 07, 2005 1:50 pm      | 
			 
			
				Sounds like you want to be using %proper instead of %upper.
 
 
From zMud help:
 
 
 
	  | Quote: | 
	 
	
	  
 
#SHOW %upper("this IS a test.")
 
displays:
 
THIS IS A TEST.
 
 
Syntax: %proper(s)
 
 
\Converts to proper case (lowercase except for first letter).
 
Examples:
 
#SHOW %proper("this IS a test.")
 
Displays:  This is a test.
 
 | 
	 
 
 
 
Only problem I can see is if the variable contains capital letters already that you want to preserve.
 
 
E.g.
 
 
 
	  | Code: | 
	 
	
	  testVar=aBcDeF
 
#SHOW %proper(@testVar) | 
	 
 
 
would display: Abcdef
 
 
whereas you may want it to show
 
ABcDeF
 
 
Which would be done with
 
 
	  | Code: | 
	 
	
	  | #show %upper(%left(@testVar,1))%rightback(@testVar,(%len(@testVar)-1)) | 
	 
 
 
 
Hope it helps,
 
 
Guinn | 
			 
		  | 
	
	
	  | 
		  
		 | 
	
	
		  | 
	
	
		TonyWhispers Newbie
 
  Joined: 30 Jan 2005 Posts: 8
 
  | 
		
		  
			
			   Posted: Mon Feb 07, 2005 2:43 pm   Re: Guinn   | 
			 
			
				Awesome logic Guinn!   
  | 
			 
		  | 
	
	
	  
		  
		    
			  _________________ zMUD Manual Source
 
Preventing Dead Posts: If the Tech Support solved your problem, please state as such. Thanks. | 
			       | 
			 
		   
		 | 
	
	
		  | 
	
	
		Lench Beginner
 
  Joined: 26 Jan 2004 Posts: 21 Location: Norway
  | 
		
		  
			
			   Posted: Mon Feb 07, 2005 3:28 pm   worked fine   | 
			 
			
				%proper was the function i was looking for :)
 
 
Thanks :)
 
 
should probably be a link to that from the %upper help file? | 
			 
		  | 
	
	
	  
		  
		    
			  _________________   | 
			       | 
			 
		   
		 | 
	
	
		  | 
	
	
		Guinn Wizard
 
  Joined: 03 Mar 2001 Posts: 1127 Location: London
  | 
		
		  
			
			   Posted: Mon Feb 07, 2005 3:37 pm      | 
			 
			
				There is - it's in the 'related functions' bit :)
  | 
			 
		  | 
	
	
	  | 
		  
		 | 
	
	
		  | 
	
	
		Lench Beginner
 
  Joined: 26 Jan 2004 Posts: 21 Location: Norway
  | 
		
		  
			
			   Posted: Mon Feb 07, 2005 6:06 pm      | 
			 
			
				
 
	  | Guinn wrote: | 
	 
	
	  | There is - it's in the 'related functions' bit :) | 
	 
 
 
 
odd i couldnt find it, but then again im known to be blind at times *grin* | 
			 
		  | 
	
	
	  
		  
		    
			  _________________   | 
			       | 
			 
		   
		 | 
	
	
		  | 
	
	
		| 
		
		 | 
	
	
		 |