Method: CBETA.linehead_to_s

Defined in:
lib/cbeta.rb

.linehead_to_s(linehead) ⇒ String

將行首資訊轉為引用格式

Examples:

CBETA.linehead_to_s('T85n2838_p1291a03')
# return "T85, no. 2838, p. 1291, a03"

Parameters:

  • linehead (String)

    行首資訊, 例如:T85n2838_p1291a03

Returns:

  • (String)

    引用格式的出處資訊,例如:T85, no. 2838, p. 1291, a03



20
21
22
23
24
25
# File 'lib/cbeta.rb', line 20

def self.linehead_to_s(linehead)
  linehead.match(/^([A-Z]\d+)n(.*)_p(\d+)([a-z]\d+)$/) {
    return "#{$1}, no. #{$2}, p. #{$3}, #{$4}"
  }
  nil
end