# Function searchindex not defined?

**URL:** <https://discourse.julialang.org/t/function-searchindex-not-defined/48854>\
**Category:** General Usage\
**Created:** [October 23, 2020, 2:52am UTC](https://discourse.julialang.org/t/function-searchindex-not-defined/48854 "2020-10-23T02:52:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![KW2P](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kw2p/32/18659_2.png) [@KW2P](https://discourse.julialang.org/u/KW2P)\
**Post date:** [October 23, 2020, 2:52am UTC](https://discourse.julialang.org/t/function-searchindex-not-defined/48854/1 "2020-10-23T02:52:16Z")

</div>

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

I get this error:

```julia
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:

```julia
  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?

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [October 23, 2020, 3:46am UTC](https://discourse.julialang.org/t/function-searchindex-not-defined/48854/2 "2020-10-23T03:46:32Z")

</div>

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](https://docs.julialang.org/en/v1/manual/strings/#Common-Operations)

---

<div class="post-metadata">

**Author:** ![KW2P](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kw2p/32/18659_2.png) [@KW2P](https://discourse.julialang.org/u/KW2P)\
**Post date:** [October 23, 2020, 4:04am UTC](https://discourse.julialang.org/t/function-searchindex-not-defined/48854/3 "2020-10-23T04:04:42Z")

</div>

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

findfirst() would seem to do the job.

Thank you
