N.B. I know it's easier with `re`:
    
    
    import re
    import strutils
    
    let commentChars = {'#', ';'}
    let nonspace = re"(\S)"
    let line = "    ; abc "
    var matches = newSeq[string](1)
    
    let m = line.find(nonspace, matches)
    let is_comment = matches[0][0] in commentChars
    echo "$# $#" % [$m, $is_comment]
    

Reply via email to