def CheckSDSSString(theString):
    """Simple function to vet strings containing SDSS field specifications:
	"run rerun camcol field" or "run,rerun,camcol,field" for DR7;
	"run camcol field" or "run,camcol,field" for DR12. Also, camcol must
	be between 1 and 6.
	
	Returns 1 for valid DR7 field specification, 2 for valid DR12 specification,
	or 0 for bad field specification.
	"""
    pps = theString.split()
    ppc = theString.split(',')
    if len(pps) in [3, 4]:
        pp = pps
    elif len(ppc) in [3, 4]:
        pp = ppc
    else:
        return 0
    try:
        for p in pp:
            testv = int(p)
            if testv < 0:
                return 0
    except ValueError:
        return 0
    if len(pp) == 3:
        camcol = int(pp[1])
        fieldType = 2
    else:
        camcol = int(pp[2])
        fieldType = 1
    if camcol > 6 or camcol < 1:
        return 0
    return fieldType
