Questions about string

Amazing, now I need to learn about Word2Vec and NLP in Julia after this

Consider using (studying) this solution (of @rafael.guerra) which is surely more flexible than mine (built only on a for loop) and also very efficient.

function numberstrip3(c, pattern)
    d = split(c, pattern)
    pop!(d)
    v = filter(!isempty, d)
    ix = findlast.(!isdigit, v)
    s = Int[]
    for (i,u) in zip(ix,v)
        if isnothing(i)
            push!(s, parse(Int,u))
        else
            x = tryparse(Int, u[i+1:end])
            !isnothing(x) && push!(s, x)
        end
    end
    return s
end
1 Like