Function searchindex not defined?

This has to be something dumb but I’m not seeing it.

I get this error:

ERROR: LoadError: UndefVarError: searchindex not defined
Stacktrace:
 [1] readConfigFile() at /home/phil/dev/jdev/utils.jl:114
 [2] top-level scope at /home/phil/dev/jdev/jtest1.jl:52
 [3] include(::Function, ::Module, ::String) at ./Base.jl:380
 [4] include(::Module, ::String) at ./Base.jl:368
 [5] exec_options(::Base.JLOptions) at ./client.jl:296
 [6] _start() at ./client.jl:506
in expression starting at /home/phil/dev/jdev/jtest1.jl:52

On the following section of code:

  while ! eof(fp)   
    s = readline(fp)
    global lineCounter += 1
    if length(s) == 0
      continue
    end

    # skip lines that begin with #, ;, or whitespace
    if isspace(s[1]) || s[1]=='#' || s[1]==';'
      continue
    end

    # might we have a section name here?
    if s[1]=='['
      i = searchindex(s, "]")
      if i==0
        global error = 1   # malformed section name
        break;
      end

The isspace() function is executing, so the Base string functions must be visible. Yet it doesn’t know what searchindex() is.

Is there some additional module I need to use or include?

that’s some old old function… you may want to look at a different tutorial.

https://docs.julialang.org/en/v1/manual/strings/#Common-Operations

2 Likes

So I guess searchindex() is deprecated. I didn’t know.

findfirst() would seem to do the job.

Thank you