//
//  NSString+Helper.m
//  AWCordovaPlugins
//
// Copyright © 2019 - 2020 VMware, Inc. All rights reserved.
// This product is protected by copyright and intellectual property laws in the United States and other countries as well as by international treaties.
// AirWatch products may be covered by one or more patents listed at http:www.vmware.com/go/patents.
//

#import "NSString+Helper.h"

@implementation NSString (Helper)

- (NSString *)stringByTrimmingTrailingCharactersInSet:(NSCharacterSet *)set {
    NSRange rangeOfLaststWantedCharacter = [self rangeOfCharacterFromSet:[set invertedSet] options:NSBackwardsSearch];
    if (rangeOfLaststWantedCharacter.location == NSNotFound) {
        return @"";
    }
    return [self substringToIndex:(rangeOfLaststWantedCharacter.location +1)];
}

@end
