fn obsolete(options: &[String]) -> (Vec<String>, Option<usize>) {
    let mut options: Vec<String> = options.to_vec();
    let mut a = 0;
    let b = options.len();

    while a < b {
        let current = options[a].clone();
        let current = current.as_bytes();

        if current.len() > 1 && current[0] == '-' as u8 {
            let len = current.len();
            for pos in 1 .. len {
                // Ensure that the argument is only made out of digits
                if !(current[pos] as char).is_numeric() { break; }

                // If this is the last number
                if pos == len - 1 {
                    options.remove(a);
                    let number: Option<usize> = from_utf8(&current[1..len]).unwrap().parse().ok();
                    return (options, Some(number.unwrap()));
                }
            }
        }

        a += 1;
    };

    (options, None)
}
// It searches for an option in the form of -123123
//
// In case is found, the options vector will get rid of that object so that
// getopts works correctly.
It searches for an option in the form of -123123
In case is found, the options vector will get rid of that object so that
getopts works correctly.
It searches for an option in the form of - 123123 In case is found the options vector will get rid of that object so that getopts works correctly .
fn obsolete(options: &[String]) -> (Vec<String>, Option<usize>) {
    let mut options: Vec<String> = options.to_vec();
    let mut a = 0;
    let b = options.len();
    while a < b {
        let current = options[a].clone();
        let current = current.as_bytes();
        if current.len() > 1 && current[0] == '-' as u8 {
            let len = current.len();
            for pos in 1 .. len {
                // Ensure that the argument is only made out of digits
                if !(current[pos] as char).is_numeric() { break; }
                // If this is the last number
                if pos == len - 1 {
                    options.remove(a);
                    let number: Option<usize> = from_utf8(&current[1..len]).unwrap().parse().ok();
                    return (options, Some(number.unwrap()));
                }
            }
        }
        a += 1;
    };
    (options, None)
}
fn obsolete ( options : & [ String ] ) -> ( Vec < String > , Option < usize > ) { let mut options : Vec < String > = options . to_vec ( ) ; let mut a = 0 ; let b = options . len ( ) ; while a < b { let current = options [ a ] . clone ( ) ; let current = current . as_bytes ( ) ; if current . len ( ) > 1 && current [ 0 ] == '-' as u8 { let len = current . len ( ) ; for pos in 1 .. len { // Ensure that the argument is only made out of digits if ! ( current [ pos ] as char ) . is_numeric ( ) { break ; } // If this is the last number if pos == len - 1 { options . remove ( a ) ; let number : Option < usize > = from_utf8 ( & current [ 1 .. len ] ) . unwrap ( ) . parse ( ) . ok ( ) ; return ( options , Some ( number . unwrap ( ) ) ) ; } } } a += 1 ; } ; ( options , None ) }
It searches for an option in the form of -123123
In case is found, the options vector will get rid of that object so that
getopts works correctly.
It searches for an option in the form of - 123123 In case is found the options vector will get rid of that object so that getopts works correctly .
options
&[String]
options
&[String]