title: extract a substring from a string in smalltalk (squeak)
body: <p>I'm trying to extract a substring from a string which would be the substring in between 2 delimiters
  i.e it should be defined as follows:</p>
  
  <pre><code>substring: aString delimiter: aDelimiter
  </code></pre>
  
  <p>and, for an example, if i'll get this line:</p>
  
  <pre><code>substring: 'dddd#sss#dddd' delimiter: '#'
  </code></pre>
  
  <p>the function should return 'sss'.</p>
  
  <p>this is what i've been trying, which didn't work:</p>
  
  <pre><code>substring: aString delimiter: aDelimiter
  |index temp1 temp2 sz arr str|
        arr := aString asArray.
        sz := arr size.
        index := arr lastIndexOf: aDelimiter.
        temp1 := arr first: (sz - index +1).
        index := temp1 lastIndexOf: aDelimiter.
        sz :=temp1 size.
        temp2 := temp1 first: (sz - index).
        str := temp2 asString.
        ^str.
  </code></pre>
  
  <p>I don't know if it's worth mentioning but it's supposed to be a class method.</p>