GetInQuotes: Get string from between quotes: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Added page author. zukex is a forum user, not a page.)
Line 1: Line 1:
{{PageAuthor|Afrow UK}}
== Description ==
== Description ==


This function was written for [[zukex]] in [http://forums.winamp.com/showthread.php?postid=1719092 this forum topic]. It takes a string from between quotes in another string. If no paired quotes are found, the function will return an empty string.
This function was written for [[User:zukex|zukex]] in [http://forums.winamp.com/showthread.php?postid=1719092 this forum topic]. It takes a string from between quotes in another string. If no paired quotes are found, the function will return an empty string.


== Usage ==
== Usage ==

Revision as of 18:21, 3 July 2005

Author: Afrow UK (talk, contrib)


Description

This function was written for zukex in this forum topic. It takes a string from between quotes in another string. If no paired quotes are found, the function will return an empty string.

Usage

Push 'a string containing "quotes"!'
Call GetInQuotes
Pop $R0 ; = quotes

The Function

Function GetInQuotes
Exch $R0
Push $R1
Push $R2
Push $R3
 
 StrCpy $R2 0
 IntOp $R2 $R2 + 1
  StrCpy $R3 $R0 1 $R2
  StrCmp $R3 "" 0 +3
   StrCpy $R0 ""
   Goto Done
  StrCmp $R3 '"' 0 -5
 
 IntOp $R2 $R2 + 1
 StrCpy $R0 $R0 "" $R2
 
 StrCpy $R2 0
 IntOp $R2 $R2 + 1
  StrCpy $R3 $R0 1 $R2
  StrCmp $R3 "" 0 +3
   StrCpy $R0 ""
   Goto Done
  StrCmp $R3 '"' 0 -5
 
 StrCpy $R0 $R0 $R2
 Done:
 
Pop $R3
Pop $R2
Pop $R1
Exch $R0
FunctionEnd

-Stu