summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/netlist/nl_util.h
blob: 5016befe09809f6a86c94361b6e037a6564780ca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
 * nl_util.h
 *
 */

#ifndef NL_UTIL_H_
#define NL_UTIL_H_

#include "pstring.h"
#include "nl_lists.h"

class nl_util
{
// this is purely static
private:
    nl_util() {};

public:
    typedef netlist_list_t<pstring, 10> pstring_list;

    static pstring_list split(const pstring &str, const pstring &onstr)
    {
        pstring_list temp;

        int p = 0;
        int pn;

        pn = str.find(onstr, p);
        while (pn>=0)
        {
            temp.add(str.substr(p, pn - p));
            p = pn + onstr.len();
            pn = str.find(onstr, p);
        }
        if (p<str.len())
            temp.add(str.substr(p));
        return temp;
    }
};

#endif /* NL_UTIL_H_ */