adds partial function substr. the use of this function should be guarded, especially for disequalities