void set_vcf_record_chromosome(char* chromosome, int length, vcf_record_t* record) { assert(chromosome); assert(record); if (starts_with_n(chromosome, "chrom", 5)) { record->chromosome = chromosome + 5; record->chromosome_len = length - 5; } else if (starts_with_n(chromosome, "chr", 3)) { record->chromosome = chromosome + 3; record->chromosome_len = length - 3; } else { record->chromosome = chromosome; record->chromosome_len = length; } // LOG_DEBUG_F("set chromosome: '%.*s'\n", record->chromosome_len, record->chromosome); }
/*! * \brief Check if string has prefix * (case sensitive) * * \param string String * \param prefix Prefix * * \return Whether the string starts with the prefix */ bool starts_with(const std::string &string, const std::string &prefix) { return starts_with_n(string.c_str(), string.size(), prefix.c_str(), prefix.size()); }
/*! * \brief Check if string has prefix * (case sensitive) * * \param string String * \param prefix Prefix * * \return Whether the string starts with the prefix */ bool starts_with(const std::string &string, const char *prefix) { return starts_with_n(string.c_str(), string.size(), prefix, strlen(prefix)); }
/*! * \brief Check if string has prefix * (case sensitive) * * \param string String * \param prefix Prefix * * \return Whether the string starts with the prefix */ bool starts_with(const char *string, const std::string &prefix) { return starts_with_n(string, strlen(string), prefix.c_str(), prefix.size()); }
/*! * \brief Check if string has prefix * (case sensitive) * * \param string String * \param prefix Prefix * * \return Whether the string starts with the prefix */ bool starts_with(const char *string, const char *prefix) { return starts_with_n(string, strlen(string), prefix, strlen(prefix)); }