The words Under construction in black text on a yellow background with diagonal black stipes surrounding it
I'm in the process of moving my site. It's still a work in progress. Please excuse the mess and broken links.

Kabob-Case A String In Python

TODO: Pull subtitle into page object

This is an adaptation of my snake_case function (TKTKTK: link to snake_case function when the site is moved). Haven't put a full test suite on it yet, but spot checking it seems to be fine.

code_start_default_section code_end_default_section

Debugging Stuff

I'm moving stuff around right now. All this below is helping me figure out where to put stuff

        -- title

Kabob-Case A String In Python

-- p

This is an adaptation of my snake_case function (TKTKTK: link to snake_case function when the site is moved). Haven't put a full test suite on it yet, but spot checking it seems to be fine.

-- code/
-- python3

#!/usr/bin/env python3

import re 

def kabob(initial_string):
    
    return_string = initial_string.lower().replace(' ', '-')
    return_string = re.sub("'", '', return_string)
    return_string = re.sub('[^\w\.]', '-', return_string)
    return_string = re.sub('-+', '-', return_string)
    return_string = re.sub('-\.', '.', return_string)
    return_string = re.sub('\.-', '.', return_string)
    return_string = re.sub('^-+', '', return_string)
    
    return return_string

kabob_string = kabob('Kabob Case A String In Python')

print(kabob_string)

-- /code


-- categories
-- Python

-- metadata
-- date: 2021-08-31 20:31:06
-- id: 20eop7kx
-- status: published
-- type: post
-- SCRUBBED_NEO: false
-- site: aws