quran-meta
    Preparing search index...

    Function formatSurahAyah

    • Formats a surah/ayah reference as a string. This is the inverse of ayahStringSplitter.

      Parameters

      • ref: SurahAyah | SurahAyahSegment

        [surah, ayah] or [surah, [fromAyah, toAyah]]

      • separator: string = ":"

        Text between surah and ayah, ":" by default

      Returns string

      The reference as "surah:ayah" or "surah:from-to"

      formatSurahAyah([2, 255]) // "2:255"
      formatSurahAyah([1, [1, 7]]) // "1:1-7"
      formatSurahAyah([2, 255], ".") // "2.255"
      formatSurahAyah(ayahStringSplitter("18:1-10")) // "18:1-10"